Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vishalbandre/01bdcae0510d7831291e292a99a37a39 to your computer and use it in GitHub Desktop.
Save vishalbandre/01bdcae0510d7831291e292a99a37a39 to your computer and use it in GitHub Desktop.
Copy template inside the templates directory in your module.
Then, reuse this snippet as per your overriden template.
Example:
If you want to override template: page--taxonomy.html.twig
1. Copy the template inside your modules templates directory.
2. Register it with your module preprocessor. i.e. <module_name>.module.
/**
* Implements hook_theme().
*/
function hashtags_explore_theme() {
return [
'page__taxonomy' => [
'template' => 'page--taxonomy',
'base hook' => 'page',
],
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment