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

[TwigBundle][DX] Only add the Twig WebLinkExtension if the WebLink component is enabled #27626

Merged
merged 1 commit into from Jun 25, 2018

Conversation

Projects
None yet
5 participants
@thewilkybarkid
Contributor

thewilkybarkid commented Jun 18, 2018

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.

@@ -71,6 +72,10 @@ public static function onUndefinedFunction($name)
return false;
}
if (\class_exists(FullStack::class) && 'web-link' === self::$functionComponents[$name]) {

This comment has been minimized.

@stof

stof Jun 19, 2018

Member

what about other components needing to be enabled ?

This comment has been minimized.

@thewilkybarkid

thewilkybarkid Jun 19, 2018

Contributor

For the other functions/filters?

This comment has been minimized.

@stof

stof Jun 19, 2018

Member

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"',

This comment has been minimized.

@thewilkybarkid

thewilkybarkid Jun 20, 2018

Contributor

I think these are right, and the only ones effected.

@fabpot

fabpot approved these changes Jun 25, 2018

@fabpot

This comment has been minimized.

Member

fabpot commented Jun 25, 2018

Thank you @thewilkybarkid.

@fabpot fabpot merged commit cccb66f into symfony:3.4 Jun 25, 2018

1 of 3 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Jun 25, 2018

bug #27626 [TwigBundle][DX] Only add the Twig WebLinkExtension if the…
… 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

@thewilkybarkid thewilkybarkid deleted the thewilkybarkid:twig-web-link branch Jun 25, 2018

This was referenced Jun 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment