diff --git a/core/modules/node/templates/node-add-list.html.twig b/core/modules/node/templates/node-add-list.html.twig index 258d3e6..c64751b 100644 --- a/core/modules/node/templates/node-add-list.html.twig +++ b/core/modules/node/templates/node-add-list.html.twig @@ -16,7 +16,7 @@ */ #} {% if types is not empty %} -
+
{% for type in types %}
{{ type.add_link }}
{{ type.description }}
diff --git a/core/modules/node/templates/node-edit-form.html.twig b/core/modules/node/templates/node-edit-form.html.twig index 6d8ac2a..79f066c 100644 --- a/core/modules/node/templates/node-edit-form.html.twig +++ b/core/modules/node/templates/node-edit-form.html.twig @@ -17,14 +17,6 @@ * @ingroup themeable */ #} -
-
- {{ form|without('advanced', 'actions') }} -
-
- {{ form.advanced }} -
- +
+ {{ form }}
diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index a78fcb3..f460f43 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -68,17 +68,7 @@ * @ingroup themeable */ #} -{% - set classes = [ - 'node', - 'node--type-' ~ node.bundle|clean_class, - node.isPromoted() ? 'node--promoted', - node.isSticky() ? 'node--sticky', - not node.isPublished() ? 'node--unpublished', - view_mode ? 'node--view-mode-' ~ view_mode|clean_class, - ] -%} - + {{ title_prefix }} {% if not page %} @@ -89,23 +79,17 @@ {{ title_suffix }} {% if display_submitted %} -
+
{{ author_picture }} - + {% trans %}Submitted by {{ author_name|passthrough }} on {{ date|passthrough }}{% endtrans %} {{ metadata }}
{% endif %} - - {{ content|without('links') }} + + {{ content }} - {% if content.links %} - - {% endif %} - diff --git a/core/modules/system/src/Tests/Entity/EntityTemplateSuggestionsTest.php b/core/modules/system/src/Tests/Entity/EntityTemplateSuggestionsTest.php new file mode 100644 index 0000000..d11ec25 --- /dev/null +++ b/core/modules/system/src/Tests/Entity/EntityTemplateSuggestionsTest.php @@ -0,0 +1,98 @@ +entity_name = $this->randomMachineName(); + $this->entity_user = $this->createUser(); + + // Pass in the value of the name field when creating. With the user + // field we test setting a field after creation. + $entity = entity_create($entity_type); + $entity->user_id->target_id = $this->entity_user->id(); + $entity->name->value = $this->entity_name; + + return $entity; + } + + /** + * Tests generation of template suggestions based on entity properties. + */ + public function testReadWrite() { + + // All entity variations have to have the same results. + foreach (entity_test_entity_types() as $entity_type) { + $this->assertTemplateSuggestions($entity_type); + } + } + + /** + * Executes the template suggestions test set for a defined entity type. + * + * @param string $entity_type + * The entity type to run the tests with. + */ + protected function assertTemplateSuggestions($entity_type) { + $entity = $this->createTestEntity($entity_type); + + $entity_definition = \Drupal::entityManager()->getDefinition($entity_type, FALSE); + + if ($entity_definition->hasViewBuilderClass()) { + $view_modes = \Drupal::entityManager()->getFormModes($entity_type); + + foreach ($view_modes as $id => $view_mode) { + + if ($view_builder = \Drupal::entityManager()->getViewBuilder($entity_type)) { + $entity_id = rand(1, 20); + $sanitized_view_mode = strtr($id, '.', '_'); + $bundle_name = $entity->bundle(); + $entity->{$entity_definition->getKey('id')} = $entity_id; + + $suggestions = $view_builder->getTemplateSuggestions($entity, $id); + + $expected = array( + $entity_type . '__' . $sanitized_view_mode, + $entity_type . '__' . $bundle_name, + $entity_type . '__' . $bundle_name . '__' . $sanitized_view_mode, + $entity_type . '__' . $entity_id, + $entity_type . '__' . $entity_id . '__' . $sanitized_view_mode, + ); + + $this->assertEqual($expected, $suggestions, json_encode($suggestions)); + } + } + } + } + +} diff --git a/core/themes/classy/templates/field--node--created.html.twig b/core/themes/classy/templates/field--node--created.html.twig new file mode 100644 index 0000000..5799a6c --- /dev/null +++ b/core/themes/classy/templates/field--node--created.html.twig @@ -0,0 +1,24 @@ +{# +/** + * @file + * Default theme implementation for the node created field. + * + * This is an override of field.html.twig for the node created field. See that + * template for documentation about its details and overrides. + * + * Available variables: + * - attributes: HTML attributes for the containing span element. + * - items: List of all the field items. Each item contains: + * - attributes: List of HTML attributes for each item. + * - content: The field item content. + * + * @see field.html.twig + * + * @ingroup themeable + */ +#} + + {%- for item in items -%} + {{ item.content }} + {%- endfor -%} + diff --git a/core/themes/classy/templates/field--node--title.html.twig b/core/themes/classy/templates/field--node--title.html.twig new file mode 100644 index 0000000..3f37f83 --- /dev/null +++ b/core/themes/classy/templates/field--node--title.html.twig @@ -0,0 +1,24 @@ +{# +/** + * @file + * Default theme implementation for the node title field. + * + * This is an override of field.html.twig for the node title field. See that + * template for documentation about its details and overrides. + * + * Available variables: + * - attributes: HTML attributes for the containing span element. + * - items: List of all the field items. Each item contains: + * - attributes: List of HTML attributes for each item. + * - content: The field item content. + * + * @see field.html.twig + * + * @ingroup themeable + */ +#} + + {%- for item in items -%} + {{ item.content }} + {%- endfor -%} + diff --git a/core/themes/classy/templates/field--node--uid.html.twig b/core/themes/classy/templates/field--node--uid.html.twig new file mode 100644 index 0000000..c4318a6 --- /dev/null +++ b/core/themes/classy/templates/field--node--uid.html.twig @@ -0,0 +1,24 @@ +{# +/** + * @file + * Default theme implementation for the node user field. + * + * This is an override of field.html.twig for the node user field. See that + * template for documentation about its details and overrides. + * + * Available variables: + * - attributes: HTML attributes for the containing span element. + * - items: List of all the field items. Each item contains: + * - attributes: List of HTML attributes for each item. + * - content: The field item content. + * + * @see field.html.twig + * + * @ingroup themeable + */ +#} + + {%- for item in items -%} + {{ item.content }} + {%- endfor -%} + diff --git a/core/modules/node/templates/node-add-list.html.twig b/core/themes/classy/templates/node-add-list.html.twig similarity index 100% copy from core/modules/node/templates/node-add-list.html.twig copy to core/themes/classy/templates/node-add-list.html.twig diff --git a/core/modules/node/templates/node-edit-form.html.twig b/core/themes/classy/templates/node-edit-form.html.twig similarity index 100% copy from core/modules/node/templates/node-edit-form.html.twig copy to core/themes/classy/templates/node-edit-form.html.twig diff --git a/core/modules/node/templates/node.html.twig b/core/themes/classy/templates/node.html.twig similarity index 100% copy from core/modules/node/templates/node.html.twig copy to core/themes/classy/templates/node.html.twig