Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The documentation formatting for the existing twig templates in pixelmord's sandbox is fairly inconsistent. People looking at existing templates as example of how to document other templates are going to perpetuate these errors.
Not all of the implementers have followed the format recommended in the Drupal Twig conversion instructions.
I've gone through and tried to bring some consistency. Patch in first comment. Alternatively, commit access to the repo would be good.
Comment | File | Size | Author |
---|---|---|---|
#1 | drupal-twig-template-cleanup-1813240.patch | 90.62 KB | jwilson3 |
Comments
Comment #1
jwilson3Things I've cleaned up:
Comment #2
Fabianx CreditAttribution: Fabianx commentedFantastic work!
Commit access granted! :-) Thanks a lot!
Comment #3
soulston CreditAttribution: soulston commentedGreat work @jwilson3
There has been some discussion about if we should output the variables as they would be output in the templates to make for more clarity and easier copy/paste http://drupal.org/node/1804710.
Should we use this:
as opposed to this:
It would be good to make the decision one way or the other. I prefer the use of the {{ item }} as it makes it easer to discern what the variables are, easier to copy paste and prevents ambiguity in the case where we might document twig tags eg. {% if page != true %}.
Comment #4
Fabianx CreditAttribution: Fabianx commentedI made #1804710: [policy, no patch] Decide how to document Twig template files critical to discuss that there.
Comment #5
jwilson3Thanks, patch committed.
I've subscribed to #1804710 and would be happy to update existing docs again assuming the {{ notation }} is adopted.
Anyone feel free to reopen this if other twig files need formatting help, as they roll in.
Comment #6
Fabianx CreditAttribution: Fabianx commentedWe are continuing in #1759168: Comments in twig files [policy, no patch], but it seems {{ }} is out. So docs should be fine.
Comment #7
jenlamptonJust a follow up here...
We talked about this in the weekly twig meeting today, and we decided that the existing syntax should be sufficient.
In PHPTemplate, we did NOT write this in the docs:
so there is no reason to include the print statements for Twig, either.
There will be plenty of examples how the variable is being printed, and evaluated, in the Twig code below, and we expect most front-end devs to copy and paste from there as well.
Comment #8
jwilson3In #1759168-15: Comments in twig files [policy, no patch], jhodgdon brings up a good point: "themeable" is misspelled in many twig templates. Reopening to fix that issue.
Comment #9
jwilson3Done: http://drupalcode.org/sandbox/pixelmord/1750250.git/commit/926abb9
Note that in this commit, I've also fixed two instances outside of the stark/templates folder that were not additions from the work going on in this project and already exist in core. I'm not sure if this is a faux-pas or not. The misspelling in core/includes/form.inc appears to have been introduced in this branch, but the ones in install.core.inc and toolbar.module are preexisting issues in core.
Comment #10
jwilson3Comment #11
podarok#9 looks good
Comment #12
jwilson3Thanks, marking fixed, since the commit is in.
Comment #13
jhodgdonjwilson: Thanks for fixing those themeable misspellings -- I personally don't care if it's considered a faux pas or not, it's appreciated. :)
Comment #15
star-szrI've been reversing the following change made in #1 in the core queue:
Per http://drupal.org/node/1354#see the parens need to be there for Doxygen formatting since they are functions.
I'm going to ask about getting sandbox access so I can fix these.
Comment #16
star-szrThanks for all your work on this @jwilson3, I just made a couple commits here in the sandbox which should help during the transition to the core queue.
Comment #17
jwilson3Good point Cottser, thanks for pointing me to the API documentation and for fixing that up!
Comment #18
jwilson3oops