This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/vendor/chi-teck/drupal-code-generator/templates/d8/template-module.twig

35 lines
648 B
Twig
Raw Normal View History

2018-11-23 12:29:20 +00:00
<?php
/**
* @file
* Primary module hooks for {{ name }} module.
*/
{% if create_theme %}
/**
* Implements hook_theme().
*/
function {{ machine_name }}_theme() {
return [
'{{ template_name|h2u }}' => [
'variables' => ['foo' => NULL],
],
];
}
{% endif %}
{% if create_preprocess %}
/**
* Prepares variables for {{ template_name }} template.
*
* Default template: {{ template_name }}.html.twig.
*
* @param array $variables
* An associative array containing:
* - foo: Foo variable description.
*/
function template_preprocess_{{ template_name|h2u }}(array &$variables) {
$variables['foo'] = 'bar';
}
{% endif %}