11. FromPHPtoTwig
Similar to D7 theming--pass tings into the $variables[] array
from a preprocessing function.
function hook_preprocess_page(&$variables) {
$variables[‘title’] = ‘Come to the dark side.’;
$variables[‘page_class’] = ‘page-dark-side’;
}
{{ title }}
{{ page_class }}
16. ● Return render arrays
from preprocessing
functions
● Call filters and
functions from template
files
See more:
https://www.drupal.org/node/1920746
BestPractices