Hello friends,
I recently purchased a theme for my Drupal website. Inside the theme folder there is -> templates/page--front.html.twig & page.html.twig
The a snippet of the <footer></footer> in page.html.twig looks as follows:
<footer class="site-footer">
<div class="layout-container">
{% if page.footer_first or page.footer_second or page.footer_third %}
<div class="footer-top">
<div class="footer-top-inner">
{{ page.footer_first }}
{{ page.footer_second }}
{{ page.footer_third }}
</div>
</div>
{% endif %}
{% if page.footer_left or page.footer_right %}
<div class="footer-bottom">
<div class="footer-bottom-inner">
{{ page.footer_left }}
{{ page.footer_right }}
</div><!-- /.footer-bottom-inner -->
</div>
{% endif %}
</div>
</footer>
I have a custom module that also has a templates folder. Do my custom module .html.twig files automatically extend/use the page.html.twig located inside my theme/templates? If so how would I got about adding sections like page.footer_left to the templates in my custom module?
I have tried adding a page variable in business_listing.module (business_listing is my custom module name):
function business_listing_theme($existing, $type, $theme, $path) {
return [
// business-listing-detail.html.twig
'business_listing_detail' => [
'variables' => ['data' => [], 'slides' => [], 'paths' => [], 'page' => []],
]
];
}Then adding this via the render array of the function that loads my page in the controller like :
$page['footer_left'] = "This should appear in the .footer-bottom div?";
$build = [];
$build['business_listing_detail'] = [
'#theme' => 'business_listing_detail',
'#data' => $record,
'#slides' => $slides,
'#paths' => $this->paths,
'#page' => $page
];
return $build;But nothing appears? Any help and advice would be greatly appreciated <3 The theme is not my own, I am just trying to add pages that utilize its regions via a custom module.