Created
February 10, 2013 19:31
-
-
Save steveoliver/4750736 to your computer and use it in GitHub Desktop.
Drupal 8 Best Practices in Preprocess functions and Twig templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h3 id="bestpractices">Best Practices in Preprocess Functions and Twig Templates</h3> | |
| In order to minimize wasteful calls to unneeded resources and make Drupal 8 themeing as performant as possible, please follow these best practices: | |
| <ol> | |
| <li>Always call <code>t()</code> within templates; never call t() in preprocess.</li> | |
| <li>Always return render arrays instead of ever calling <code>theme()</code> within a preprocess function.</li> | |
| </ol> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment