I've created a custom module in Drupal 8. I want the custom module to display a custom header instead of the standard one shown on all other pages.
I've created a custom twig template using the documentation found here: https://www.drupal.org/docs/8/theming/twig/create-custom-twig-templates-for-custom-module. I've also used this as a reference: https://www.drupal.org/forum/support/module-development-and-code-questions/2017-05-15/drupal-8-custom-module-template.
I was able to create the template, however the template seems to be called and rendered after the header template and before the footer template. So with the documentation I'm not able to alter anything in the header file.
Any idea on how I can create a custom twig file for the header for my custom module? Here is snippets of my code below:
module file:
function calendar_theme($existing, $type, $theme, $path) {
return array(
'calendar_display' => array(
'variables' => array('test' => NULL),
'template' => 'calendar-template',
),
);
}
In my controller file:
namespace Drupal\calendar\Controller;
class CivilCController {
public function calendar(){
$content[] = [
//stuff here
];
$content[] = [
//stuff here
];
return [
'#theme' => 'calendar_display',
'#test' => $content,
];
}
}
Now I have a twig file called calendar-template.html.twig
. However this file get rendered below the header.