From de8c639073208bd237fcc377a25d51c00becd54a Mon Sep 17 00:00:00 2001 From: Alison Jo <2660348+alisonjo315@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:37:53 -0400 Subject: [PATCH] block-with-button: allow class overrides also, clean up docblock (copied from LASSP/Kavli) --- .../includes/_block--with-button.html.twig | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/templates/includes/_block--with-button.html.twig b/templates/includes/_block--with-button.html.twig index aecdead..4866f72 100644 --- a/templates/includes/_block--with-button.html.twig +++ b/templates/includes/_block--with-button.html.twig @@ -2,28 +2,11 @@ /** * @file * Theme override to display a block. - * ~ Render a block with a more button in the "header-with-button" pattern + * ~ Render a block with a more button in the "header-with-button" pattern. + * ~ Allow additional classes from including template. * ~ Use "include ... with" in your block template to call this template and * ~ specify the URL for the more link. - * - * 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. - * - provider: The module or other provider that provided this block plugin. - * - Block plugin specific settings will also be stored here. - * - 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 cwd_base/block.html.twig for available variables and other info. * * @see template_preprocess_block() */ @@ -36,19 +19,32 @@ ] %} +{% set classes = classes|merge(block_add_classes|default([])) %} {% set more_link = set_more_link|default('#') %} {% set more_label = set_more_label|default('More') %} +{% set more_placement = set_more_placement|default('top') %} +{% block block_class_override %} +{% endblock %} {% if label %} -
-
- {{ label }} - -
-
+ {% if more_placement == 'top' %} +
+
+ {{ label }} + +
+
+ {% else %} +
+ {{ label }} +
+ {% endif %} {% endif %} {% block content %} {{ content }} {% endblock %} + {% if more_placement == 'bottom' %} +
{{ more_label }}
+ {% endif %}