Version 1
[yaffs-website] / vendor / drupal / console / templates / module / entity-content-page.php.twig
diff --git a/vendor/drupal/console/templates/module/entity-content-page.php.twig b/vendor/drupal/console/templates/module/entity-content-page.php.twig
new file mode 100644 (file)
index 0000000..4b855e4
--- /dev/null
@@ -0,0 +1,34 @@
+{% extends "base/file.php.twig" %}
+
+{% block file_path %}
+{{ entity_name }}.page.inc{% endblock %}
+{% block extra_info %}
+ *
+ * Page callback for {{ label }} entities.
+{% endblock %}
+
+{% block use_class %}
+use Drupal\Core\Render\Element;
+{% endblock %}
+
+{% block file_methods %}
+/**
+ * Prepares variables for {{ label }} templates.
+ *
+ * Default template: {{ entity_name }}.html.twig.
+ *
+ * @param array $variables
+ *   An associative array containing:
+ *   - elements: An associative array containing the user information and any
+ *   - attributes: HTML attributes for the containing element.
+ */
+function template_preprocess_{{ entity_name | machine_name }}(array &$variables) {
+  // Fetch {{ entity_class }} Entity Object.
+  ${{ entity_name | machine_name }} = $variables['elements']['#{{ entity_name }}'];
+
+  // Helpful $content variable for templates.
+  foreach (Element::children($variables['elements']) as $key) {
+    $variables['content'][$key] = $variables['elements'][$key];
+  }
+}
+{% endblock %}