When I want reset password I can't do it.
I got 2 errors in logs when trying reset password:
1.
[2018-01-07 00:53:59] dev.ERROR: exception 'Twig_Error_Syntax' with message 'Unknown "partial" tag in "__string_template__4b46b5a3a3cdca34660eb14ca4a16fcd5364d4250297b5357f12fb60e9ae44df" at line 7.' in C:\Users\admin\Desktop\Projects\Public\proj1\vendor\twig\twig\lib\Twig\Parser.php:181
Stack trace:
#0 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\twig\twig\lib\Twig\Parser.php(103): Twig_Parser->subparse(NULL, false)
#1 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\twig\twig\lib\Twig\Environment.php(692): Twig_Parser->parse(Object(Twig_TokenStream))
#2 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\twig\twig\lib\Twig\Environment.php(750): Twig_Environment->parse(Object(Twig_TokenStream))
#3 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\twig\twig\lib\Twig\Environment.php(447): Twig_Environment->compileSource(Object(Twig_Source))
#4 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\twig\twig\lib\Twig\Environment.php(501): Twig_Environment->loadTemplate('__string_templa...')
#5 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\october\rain\src\Parse\Twig.php(23): Twig_Environment->createTemplate('Hello {{ name }...')
#6 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(217): October\Rain\Parse\Twig->parse('Hello {{ name }...', Array)
#7 C:\Users\admin\Desktop\Projects\Public\proj1\modules\system\models\MailTemplate.php(164): Illuminate\Support\Facades\Facade::__callStatic('parse', Array)
#8 C:\Users\admin\Desktop\Projects\Public\proj1\modules\system\models\MailTemplate.php(164): October\Rain\Support\Facades\Twig::parse('Hello {{ name }...', Array)
#9 C:\Users\admin\Desktop\Projects\Public\proj1\modules\system\ServiceProvider.php(302): System\Models\MailTemplate::addContentToMailer(Object(Illuminate\Mail\Message), 'rainlab.user::m...', Array)
#10 [internal function]: System\ServiceProvider->System\{closure}(Object(October\Rain\Mail\Mailer), Object(Illuminate\Mail\Message), 'rainlab.user::m...', Array)
#11 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php(221): call_user_func_array(Object(Closure), Array)
#12 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(219): Illuminate\Events\Dispatcher->fire('mailer.beforeAd...', Array, true)
#13 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\october\rain\src\Mail\Mailer.php(203): Illuminate\Support\Facades\Facade::__callStatic('fire', Array)
#14 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\october\rain\src\Mail\Mailer.php(203): Illuminate\Support\Facades\Event::fire('mailer.beforeAd...', Array, true)
#15 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\october\rain\src\Mail\Mailer.php(49): October\Rain\Mail\Mailer->addContent(Object(Illuminate\Mail\Message), 'rainlab.user::m...', NULL, NULL, Array)
#16 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(219): October\Rain\Mail\Mailer->send('rainlab.user::m...', Array, Object(Closure))
#17 C:\Users\admin\Desktop\Projects\Public\proj1\plugins\rainlab\user\components\ResetPassword.php(93): Illuminate\Support\Facades\Facade::__callStatic('send', Array)
#18 C:\Users\admin\Desktop\Projects\Public\proj1\plugins\rainlab\user\components\ResetPassword.php(93): Illuminate\Support\Facades\Mail::send('rainlab.user::m...', Array, Object(Closure))
#19 C:\Users\admin\Desktop\Projects\Public\proj1\modules\cms\classes\ComponentBase.php(163): RainLab\User\Components\ResetPassword->onRestorePassword()
#20 C:\Users\admin\Desktop\Projects\Public\proj1\modules\cms\classes\Controller.php(698): Cms\Classes\ComponentBase->runAjaxHandler('onRestorePasswo...')
#21 C:\Users\admin\Desktop\Projects\Public\proj1\modules\cms\classes\Controller.php(621): Cms\Classes\Controller->runAjaxHandler('resetPassword::...')
#22 C:\Users\admin\Desktop\Projects\Public\proj1\modules\cms\classes\Controller.php(330): Cms\Classes\Controller->execAjaxHandlers()
#23 C:\Users\admin\Desktop\Projects\Public\proj1\modules\cms\classes\Controller.php(213): Cms\Classes\Controller->runPage(Object(Cms\Classes\Page))
#24 C:\Users\admin\Desktop\Projects\Public\proj1\modules\cms\classes\CmsController.php(50): Cms\Classes\Controller->run('reset-password')
#25 [internal function]: Cms\Classes\CmsController->run('reset-password')
#26 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(256): call_user_func_array(Array, Array)
#27 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(164): Illuminate\Routing\Controller->callAction('run', Array)
#28 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(112): Illuminate\Routing\ControllerDispatcher->call(Object(Cms\Classes\CmsController), Object(Illuminate\Routing\Route), 'run')
#29 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#30 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#31 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#32 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#33 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(114): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#34 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(69): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(Cms\Classes\CmsController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'run')
#35 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'Cms\\Classes\\Cms...', 'run')
#36 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\Route.php(134): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#37 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\Router.php(708): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#38 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#39 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#40 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#41 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#42 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\Router.php(710): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#43 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\Router.php(675): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#44 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Routing\Router.php(635): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#45 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(236): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#46 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#47 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#48 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#49 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#50 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(124): call_user_func_array(Array, Array)
#51 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#52 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(124): call_user_func_array(Array, Array)
#54 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#55 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#56 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(124): call_user_func_array(Array, Array)
#57 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#58 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#59 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(124): call_user_func_array(Array, Array)
#60 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#61 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#62 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(124): call_user_func_array(Array, Array)
#63 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#64 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#65 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#66 C:\Users\admin\Desktop\Projects\Public\proj1\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(87): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#67 C:\Users\admin\Desktop\Projects\Public\proj1\index.php(44): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#68 C:\Users\admin\Desktop\Projects\Public\proj1\server.php(18): require_once('C:\\Users\\adm...')
#69 {main}
2.
[2018-01-07 00:54:00] dev.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method October\Rain\Foundation\Exception\Handler::formatException()' in C:\Users\admin\Desktop\Projects\Public\proj1\vendor\october\rain\src\Foundation\Exception\Handler.php:137
Stack trace:
#0 {main}
Cant define steps because this error occured after some time
i have old octobercms but tryed php artisan october:update and update octobercms and all plugins (user and blog)
I cant use website anymore, what should i do?
Try php artisan cache:clear
Nope.
I found problem.
Fresh install octobercms + userplugin.
In file october\plugins\rainlab\user\views\mail\restore.htm selected code not work. I think parser cant read tag partial in email template.
{% partial 'button' url=link type='positive' body %}
Restore password
{% endpartial %}
Commented this code and all works. This is strange
Then you aren't running the latest OctoberCMS version
On Jan 7, 2018 21:59, "Artur Bekerov" notifications@github.com wrote:
Nope.
I found problem.
Fresh install octobercms + userplugin.
In file october\pluginsrainlab\user\views\mailrestore.htm selected code
not work. I think parser cant read tag partial in email template.
{% partial 'button' url=link type='positive' body %}
Restore password
{% endpartial %}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/octobercms/october/issues/3341#issuecomment-355880620,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG6vUAjk_fEkfTWhO4BtyHR-SjeCoGTPks5tIZKHgaJpZM4RVfxz
.
I install it with composer create-project october/october myoctober.
How it can't be last version?
Also i tryed on different website run october:up and last build is 431.
@bekerov because if you are installing it via composer on PHP < 7 (a requirement of October) then composer will grab the last version that supported PHP < 7, Build 419
thanks.
so why plugins also dont check php version?
Because the plugins don't define PHP as a requirement since October already does and they require October to work
Updated php to 7.2 version.
Then run php artisan october:update and it found 1 update.
Then i got error:
C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october>php artisan october:update
Updating October...
Found 1 new update!
Downloading application files
Unpacking application files
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php
:139
Stack trace:
#0 [internal function]: Illuminate\Foundation\Exceptions\Handler->Illuminate\Foundation\Exceptions\{closure}(0, 'October\\Rain\\Ex...')
#1 C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\laravel\framework\src\Illuminate\Support\Arr.php(153): call_user_func(Object(Closure), 0, 'October\\Rain\\Ex...')
#2 C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(140): Illuminate\Support\Arr::first(Array, Object(Closure))
#3 C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\october\rain\src\Foundation\Exception\Handler.php(45): Illuminate\Foundation\Exceptions\Handler->shouldntReport(Object(Symfony\Component\Debug\Exc
eption\FatalThrowableError))
#4 C:\Users\ADMIN\Desktop\Projects\Public\ in C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php on line 139
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php
:139
Stack trace:
#0 [internal function]: Illuminate\Foundation\Exceptions\Handler->Illuminate\Foundation\Exceptions\{closure}(0, 'October\\Rain\\Ex...')
#1 C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\laravel\framework\src\Illuminate\Support\Arr.php(153): call_user_func(Object(Closure), 0, 'October\\Rain\\Ex...')
#2 C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(140): Illuminate\Support\Arr::first(Array, Object(Closure))
#3 C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\october\rain\src\Foundation\Exception\Handler.php(45): Illuminate\Foundation\Exceptions\Handler->shouldntReport(Object(Symfony\Component\Debug\Exc
eption\FatalErrorException))
#4 C:\Users\ADMIN\Desktop\Projects\Public\ in C:\Users\ADMIN\Desktop\Projects\Public\proj_v2\october\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php on line 139
Tryed on 2 websites and same problem. For first website it breaks php artisan command.
In RouteRegistrar.php line 76:
Attribute [filter] does not exist.
Could you please help with it?
If you install via composer then you need to update via composer. Replace composer.json with the current version from the repository and run composer update
after replace composer.json and composer install same error :(
when laravel/framework changed from 5.1.* to 5.5.* i got this error
@bekerov the problem with the attribute filter does not exist is a plugin that is not Laravel 5.5 compatible, what is the full stack trace for that particular error?
This would be happening if you have the Build 420+ version of https://github.com/octobercms/october/blob/master/modules/backend/views/mail/invite.htm but you don't have the changes in https://github.com/octobercms/october/commit/18b9253bcbfb1480254e7e601274ad0e2279ce1f#diff-fa443c75b14275af0e30b8973b50926d or they aren't taking affect for some reason.
@LukeTowers this is my invite.htm
START
subject = "Welcome to October CMS"
layout = "system"
==
Hi {{ name }},
A user account has been created for you.
Login: {{ login }}
Password: {{ password }}
After signing in you should change your password by clicking your name on the top right corner of the administration area.
You can use the following link to sign in:
{{ link }}
==
<p>Hi {{ name }},</p>
<p>A user account has been created for you.</p>
<p>
Login: {{ login }}<br />
Password: {{ password }}
</p>
<p>After signing in you should change your password by clicking your name on the top right corner of the administration area.</p>
<p>
You can use the following link to sign in:<br />
<a href="{{ link }}">{{ link }}</a>
</p>
Should I update it by the one you sent?
@ronogrimen what build number of October are you running? Did you install with the installer or via composer?
@ronogrimen what does your composer.json look like?
{
"name": "october/october",
"description": "October CMS",
"homepage": "http://octobercms.com",
"keywords": ["october", "cms", "octobercms", "laravel"],
"license": "MIT",
"authors": [
{
"name": "Alexey Bobkov",
"email": "[email protected]",
"role": "Co-founder"
},
{
"name": "Samuel Georges",
"email": "[email protected]",
"role": "Co-founder"
}
],
"support": {
"issues": "https://github.com/octobercms/october/issues",
"forum": "http://octobercms.com/forum/",
"docs": "http://octobercms.com/docs/",
"irc": "irc://irc.freenode.net/october",
"source": "https://github.com/octobercms/october"
},
"require": {
"php": ">=5.5.9",
"october/rain": "1.0.419",
"october/system": "1.0.419",
"october/backend": "1.0.419",
"october/cms": "1.0.419",
"laravel/framework": "5.1.*",
"wikimedia/composer-merge-plugin": "dev-master"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~4.0",
"phpunit/phpunit-selenium": "~1.2"
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/UiTestCase.php",
"tests/PluginTestCase.php"
]
},
"scripts": {
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd" :[
"php artisan october:install"
],
"post-autoload-dump" : [
"php artisan october:mirror public/"
]
},
"config": {
"preferred-install": "dist",
"platform": {
"php": "7.0.22"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"merge-plugin": {
"include": [
"plugins/*/*/composer.json"
],
"recurse": true,
"replace": false,
"merge-dev": false
}
}
}
@LukeTowers
@ronogrimen you are very clearly not on build 432, you are on build 419:
"october/rain": "1.0.419",
"october/system": "1.0.419",
"october/backend": "1.0.419",
But in the backend its 432. What I need to do now? There's no update in the backend
@ronogrimen every time you run the process that updates the build number all it does is poll the latest build number from the marketplace and set it as your current build. Because your composer version is locked to 419, it would update that number incorrectly. You will need to make sure that your environment is running PHP7 and then replace your composer.json with the version of composer.json currently on the github and then run composer update.
I have a plugin which uses renatio Dynamic PDF and then mails after creation. However I am getting
"Unknown "partial" tag in "__string_template__870071e787b36ec5846a2e883824933855
de74ec2619cb3bbc6176357239bc9e" at line 16." on line 156 of
/home/434343.cloudwaysapps.com/hnjdrudstc/public_html/vendor/twig/twig/lib/Twig/Parser.php
I am on build 434 and all my plugins have been updated.
@StrangerPings what server environment are you on? How did you install October?
@LukeTowers Currently on a Cloudways LAMP stack. PHP 7.0, MySQL 5.6. I installed October via the php web installer. Let me know if I can provide anything else.
@StrangerPings did you check to see what the state of your files (mentioned here: https://github.com/octobercms/october/issues/3341#issuecomment-358512416) are compared to the git repository's versions?
I just had the same problem that was caused by a helper function I had included via composer.
The function was using Twig::parse to render a twig template. The problem was, that this call initialized Twig before the MailPartialTokenParser got registered.
When further down the stack the email got sent, Twig did not call setParser again since it already did this when it first got called from my helper function.
This left the MailPartialTokenParser registered as an uninitialized handler.
I just moved the Twig parse call into it's own class and registered it via my plugin's boot method. It seems like it's still a problem if Twig->parse is called before the email is sent.
Registering the MailPartialTokenParser permanently solves this problem. I'm not sure why the token parser is only loaded temporarily.
public function registerMarkupTags()
{
// Register token parser permantently
$markupManager = MarkupManager::instance();
$markupManager->registerTokenParsers([
new MailPartialTokenParser,
]);
}
Is there a way to force a reload of the twig environment in the MailManager?
I have to correct my previous comment. After clearing all compiled views and the cache my frontend does not work anymore.
Abviously the mail partial tag now conflicts with the default frontend partial tag.
I'll see if I can find another solution.
same +1
@Beaudinn please do not make "+1" comments. If you have nothing detailed or helpful to add to the conversation then just note your "+1" by reacting appropriately to an earlier comment in the thread.
Sorry @LukeTowers
@tobias-kuendig you can use the MailManager itself to render the markdown template into text like
MailManager::instance()->renderText($content, $data)
@Beaudinn No problem, just for future reference 😉
I ended up registring my own Twig environment. This prevents all conflicts when using my helper.
// Plugin.php
$this->app->singleton('custom.twig.environment', function ($app) {
$twig = new Twig_Environment(new TwigLoader, ['auto_reload' => true]);
$twig->addExtension(new TwigExtension);
return $twig;
});
I had the same problem and I used @tobias-kuendig solution. Thanks
Most helpful comment
I ended up registring my own Twig environment. This prevents all conflicts when using my helper.