I need to hide the footer region on all pages with url /people/. Something like with the blocks you put show only in /people/*.
1 Answer
You can use hook_preprocess_page() hook (.modue/.theme file) to hide footer region conditionally:
function Mymodulename_preprocess_page(&$vars) {
$vars['display_footer_region'] = true;
$current_path = \Drupal::service('path.current')->getPath();
$ex_string = '/people';
// set the display_footer_region false conditionally
if (strpos($current_path, $ex_string) !== false) {
$vars['display_footer_region'] = false;
}
}
Then go to page.html.twig & add the footer region inside condition:
{% if display_footer_region == true %}
{{ page.footer }}
{% endif %}
Make sure override the page.html.twig inside the custom theme
-
-
Yes you can add hook .in theme file as well like this: Mythemename_preprocess_page(&$vars)– miniNov 17 at 4:47