Mercurial > hg > cmmr2012-drupal-site
diff vendor/chi-teck/drupal-code-generator/templates/d8/template-module.twig @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/chi-teck/drupal-code-generator/templates/d8/template-module.twig Thu Jul 05 14:24:15 2018 +0000 @@ -0,0 +1,34 @@ +<?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 %}