Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / module / content-entity / model.module.twig
1 <?php
2
3 /**
4  * @file
5  * Provides {{ entity_type_label|article|lower }} entity type.
6  */
7
8 use Drupal\Core\Render\Element;
9
10 /**
11  * Implements hook_theme().
12  */
13 function {{ machine_name }}_theme() {
14   return [
15     '{{ entity_type_id }}' => [
16       'render element' => 'elements',
17     ],
18   ];
19 }
20
21 /**
22  * Prepares variables for {{ entity_type_label|lower }} templates.
23  *
24  * Default template: {{ template_name }}.
25  *
26  * @param array $variables
27  *   An associative array containing:
28  *   - elements: An associative array containing the {{ entity_type_label|lower }} information and any
29  *     fields attached to the entity.
30  *   - attributes: HTML attributes for the containing element.
31  */
32 function template_preprocess_{{ entity_type_id }}(array &$variables) {
33   foreach (Element::children($variables['elements']) as $key) {
34     $variables['content'][$key] = $variables['elements'][$key];
35   }
36 }