From 4691ba9ea4ed38d61b49bbe204a5aee301d1ff3d Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole Date: Wed, 4 Feb 2015 12:17:29 +0000 Subject: [PATCH] Issue #2349625 by mortendk, alexpott, lauriii, Manuel Garcia, saki007ster, emma.maria, DickJohnson: Copy block templates to Classy --- .../block/src/Tests/BlockViewBuilderTest.php | 4 +- .../block/templates/block-list.html.twig | 6 +-- core/modules/block/templates/block.html.twig | 8 +-- .../classy/templates/block-list.html.twig | 23 ++++++++ core/themes/classy/templates/block.html.twig | 52 +++++++++++++++++++ 5 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 core/themes/classy/templates/block-list.html.twig create mode 100644 core/themes/classy/templates/block.html.twig diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php index bd2a986e2d36..ce0d2b421dee 100644 --- a/core/modules/block/src/Tests/BlockViewBuilderTest.php +++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php @@ -83,7 +83,7 @@ class BlockViewBuilderTest extends KernelTestBase { $entity = Block::load('test_block1'); $output = entity_view($entity, 'block'); $expected = array(); - $expected[] = '
'; + $expected[] = '
'; $expected[] = ' '; $expected[] = ' '; $expected[] = ' '; @@ -107,7 +107,7 @@ class BlockViewBuilderTest extends KernelTestBase { $entity->save(); $output = entity_view($entity, 'block'); $expected = array(); - $expected[] = '
'; + $expected[] = '
'; $expected[] = ' '; $expected[] = '

Powered by Bananas

'; $expected[] = ' '; diff --git a/core/modules/block/templates/block-list.html.twig b/core/modules/block/templates/block-list.html.twig index 854d3ce85fe1..bd3c6f753813 100644 --- a/core/modules/block/templates/block-list.html.twig +++ b/core/modules/block/templates/block-list.html.twig @@ -13,11 +13,11 @@ * @ingroup themeable */ #} -
-
+
+
{{ form|without('place_blocks') }}
-
+
{{ form.place_blocks }}
diff --git a/core/modules/block/templates/block.html.twig b/core/modules/block/templates/block.html.twig index aa750cb989b5..236b3cfd1b9f 100644 --- a/core/modules/block/templates/block.html.twig +++ b/core/modules/block/templates/block.html.twig @@ -34,13 +34,7 @@ * @ingroup themeable */ #} -{% - set classes = [ - 'block', - 'block-' ~ configuration.provider|clean_class, - ] -%} - + {{ title_prefix }} {% if label %} {{ label }} diff --git a/core/themes/classy/templates/block-list.html.twig b/core/themes/classy/templates/block-list.html.twig new file mode 100644 index 000000000000..854d3ce85fe1 --- /dev/null +++ b/core/themes/classy/templates/block-list.html.twig @@ -0,0 +1,23 @@ +{# +/** + * @file + * Two column template for the block add/edit form. + * + * This template will be used when a block edit form specifies 'block_edit_form' + * as its #theme callback. Otherwise, by default, block add/edit forms will be + * themed by form.html.twig. + * + * Available variables: + * - form: The block add/edit form. + * + * @ingroup themeable + */ +#} +
+
+ {{ form|without('place_blocks') }} +
+
+ {{ form.place_blocks }} +
+
diff --git a/core/themes/classy/templates/block.html.twig b/core/themes/classy/templates/block.html.twig new file mode 100644 index 000000000000..aa750cb989b5 --- /dev/null +++ b/core/themes/classy/templates/block.html.twig @@ -0,0 +1,52 @@ +{# +/** + * @file + * Default theme implementation to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - module: The module that provided this block plugin. + * - cache: The cache settings. + * - Block plugin specific settings will also be stored here. + * - block - The full block entity. + * - label_hidden: The hidden block title value if the block was + * configured to hide the title ('label' is empty in this case). + * - module: The module that generated the block. + * - delta: An ID for the block, unique within each module. + * - region: The block region embedding the current block. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * @see template_preprocess_block() + * + * @ingroup themeable + */ +#} +{% + set classes = [ + 'block', + 'block-' ~ configuration.provider|clean_class, + ] +%} + + {{ title_prefix }} + {% if label %} + {{ label }} + {% endif %} + {{ title_suffix }} + {% block content %} + {{ content }} + {% endblock %} +