I'm using the default theme, Bootstrap Barrio, but for certain pages I'm overriding the page.html.twig
template to re-arrange the layout, however I still want the pre-processing done by my theme in bootstrap_barrio_preprocess_page
to execute so that I don't have to maintain a copy of that code inside my custom template's pre-process function, custom_module_preprocess_page__landing
.
Is there a way to override the template, but still have the original theme's pre-process run so it can setup the default variables?
I found this post that seemed to imply that adding this page suggestion hook that would then reference my page--landing
in the module that is setting things up, would achieve this, but it's not working for me.
(my template is called page--landing
, but the theme is registered as page__landing
and i've tried both syntax)
function my_module_theme_suggestions_page(array $variables) {
$path = explode('/', trim(\Drupal::service('path.current')->getPath(), '/'));
if (isset($path[0]) && $path[0] == 'landing') {
return 'page--landing';
}
}