-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBundle][DX] Only add the Twig WebLinkExtension if the WebLink component is enabled #27626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -71,6 +72,10 @@ public static function onUndefinedFunction($name) | |||
return false; | |||
} | |||
|
|||
if (\class_exists(FullStack::class) && 'web-link' === self::$functionComponents[$name]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about other components needing to be enabled ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the other functions/filters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, you add a special error message for the full stack case here when forgetting to enable a component (while the previous error message was for the non-fullstack case to tell to install a package). But web-link is not the only component needing to be enabled explicitly in a fullstack project. If we start to handled this case with nicer error messages, we should do it for all components, not only for one.
'security-core' => 'add the "SecurityBundle"', | ||
'security-http' => 'add the "SecurityBundle"', | ||
'web-link' => 'enable "framework.web_link"', | ||
'workflow' => 'enable "framework.workflows"', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are right, and the only ones effected.
…mponent is enabled
Thank you @thewilkybarkid. |
… WebLink component is enabled (thewilkybarkid) This PR was squashed before being merged into the 3.4 branch (closes #27626). Discussion ---------- [TwigBundle][DX] Only add the Twig WebLinkExtension if the WebLink component is enabled | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | While adding elifesciences/journal#990 I was a bit confused why the `preload()` Twig function didn't work initially. Turns out the WebLink component is disabled by default if using the full stack, but the Twig extension is always enabled. This only adds the Twig extension if the component is enabled, and shows a friendly error message if it's not. Commits ------- cccb66f [TwigBundle][DX] Only add the Twig WebLinkExtension if the WebLink component is enabled
While adding elifesciences/journal#990 I was a bit confused why the
preload()
Twig function didn't work initially. Turns out the WebLink component is disabled by default if using the full stack, but the Twig extension is always enabled.This only adds the Twig extension if the component is enabled, and shows a friendly error message if it's not.