Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
theme system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Mar 2013 at 01:14 UTC
Updated:
29 Jul 2014 at 22:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
steveoliver commentedFirst patch I thought we'd want to pair down Twig at install time. This patch uses all the same settings as is used normally after install.
Comment #3
steveoliver commentedWoops, last patch was missing Definition 'use'.
Comment #4
fabianx commentedI don't really like that we are duplicating code all over the place, but the install container is only meant temporary, so this is fine and not worth the trouble of creating a twig_setup function in container.
=> RTBC
=> Priority: Major, this blocks conversion work
=> Updated issue summary with commit message to include larowlan.
This was also proposed by larowlan in http://drupal.org/node/1939082#comment-7205220.
Comment #4.0
fabianx commentedUpdated issue summary.
Comment #5
star-szrWe definitely need to get this in - it's blocking more and more conversion issues. We talked about this issue briefly in IRC yesterday but I hadn't had a chance to review the patch yet. If we're not worried about code duplication, why not just a straight copy and paste of Drupal\Core\CoreBundle::registerTwig() as in #1939082-12: Convert theme_status_messages() to Twig?
My biggest concern is the hardcoding of Twig settings. At least during conversion, having debug and others available would be very useful.
This patch:
Patch from #1939082-12: Convert theme_status_messages() to Twig:
Comment #6
steveoliver commentedAttached patch is a verbatim copy of the Twig registration from CoreBundle.php, using settings() instead of hardcoded cache, debug, and auto_reload parameters.
Comment #7
star-szrLooks good to me, thanks @steveoliver!
Comment #8
fabianx commented+1 for RTBC
Comment #9
webchickFeel free to bounce back to RTBC, but a quick question.
Is there a reason we didn't just change the code in CoreBundle.php to do things like this:
'auto_reload' => settings()->get('twig_auto_reload', NULL),and then simply call registerTwig from here?This seems like an awful lot of duplicated code, and the part that's not duplicated seems like it would make sense for both CoreBundle.php and installer.
I'm actually surprised that settings() works here, but that's cool. :)
Comment #10
xjmWell, the method is currently protected. We would need to make it public and static?
Comment #11
star-szrThe code being added to install.core.inc in #6 is entirely duplicated from CoreBundle. CoreBundle::registerTwig() has the
settings()code as well, and this is what I brought up in #5, that Twig in the installer should behave the same way and respect settings added to settings.php.Here's a patch that does #10. The patch works as expected locally – I'm able to install i.e. #1939082-3: Convert theme_status_messages() to Twig and #1885564-10: theme.maintenance.inc (authorize.php) - Convert theme_ functions to Twig, but am not able to without the patch. Let's see what testbot thinks.
Comment #12
steveoliver commentedLooks good :)
Comment #13
steveoliver commentedComment #13.0
steveoliver commentedupdated commit message
Comment #14
robloachGrepped through for
registerTwig, andCoreBundle::build()provides the only reference.Comment #15
webchickMUCH BETTER. :D
Committed and pushed to 8.x. Thanks!
Comment #16
fabianx commentedOh, that works amazingly well. Another +1 for RTBC, much nicer.
Comment #17
fabianx commentedx-post ...
Comment #18
xjmFiled #1957042: Document why CoreBundle::registerTwig() is public and static. I think I had mute on when I tried to suggest this to @webchick on the phone. :)
Comment #19
star-szrThanks @xjm, good call.
Comment #20.0
(not verified) commentedAttribution to Cottser