git checkout -b mark
)lando drush cex
)We covered basic theming concepts:
We covered preprocessors. Helpful links:
In our theme file (bluecadet_base.theme) we created a variable in the node preprocess hook bluecadet_base_preprocess_node(), i.e.
$variables\['foo'] = bar;
Finally in our node’s Twig template file (themes/custom/bluecadet_base/templates/node/node--[content type].html.twig) we added the output for our variable:
{{ foo }}
We also covered debugging. Helpful links:
We covered:
Helpful links:
Core Twig templates can be found in /core/modules/system/templates
An example header template can be used to wrap block output, for ex:
<header role="banner">
{% if page.header.bluecadet_base_main_menu %}
<div class="col-center">
{{ page.header.bluecadet_base_main_menu }}
</div>
{% endif %}
{% if page.header.bluecadet_base_search %}
<div class="col-right">
{{ page.header.bluecadet_base_search }}
</div>
{% endif %}
</header>
Wherein:
page.header
denotes the page object, header regionbluecadet_base_main_menu
denotes the theme and the block machine nameIn this example we are checking for the presence of the main menu
block within the header
region, and if it exists we will wrap it within a <div> with the class col-center
For menu Twig modifications we focused on two files:
/themes/custom/bluecadet_base/templates/menu/menu.html.twig
)/themes/custom/bluecadet_base/templates/includes/header.html.twig
)Helpful links: