view vendor/chi-teck/drupal-code-generator/templates/d8/template-module.twig @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
line wrap: on
line source
<?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 %}