From c6a0d82cc07fe8d9acf14af3008190674297a94a Mon Sep 17 00:00:00 2001 From: Alison on Ubuntu VM <2660348+alisonjo315@users.noreply.github.com> Date: Fri, 2 Apr 2021 22:48:23 -0400 Subject: [PATCH 1/2] code comments on this "legacy" template --- ...--views-block--spotlight-block-1.html.twig | 45 ++----------------- 1 file changed, 4 insertions(+), 41 deletions(-) diff --git a/templates/block--views-block--spotlight-block-1.html.twig b/templates/block--views-block--spotlight-block-1.html.twig index 660d9ca..6b43741 100644 --- a/templates/block--views-block--spotlight-block-1.html.twig +++ b/templates/block--views-block--spotlight-block-1.html.twig @@ -1,48 +1,11 @@ {# /** * @file - * Default theme implementation to display a block. + * Theme override to display spotlights view block. + * LEGACY TEMPLATE, only keeping around in case it's used by older child sites -- spotlights view + * no longer has a display called block_1. * - * Available variables: - * - $block->subject: Block title. - * - $content: Block content. - * - $block->module: Module that generated the block. - * - $block->delta: An ID for the block, unique within each module. - * - $block->region: The block region embedding the current block. - * - $classes: String of classes that can be used to style contextually through - * CSS. It can be manipulated through the variable $classes_array from - * preprocess functions. The default values can be one or more of the - * following: - * - block: The current template type, i.e., "theming hook". - * - block-[module]: The module generating the block. For example, the user - * module is responsible for handling the default user navigation block. In - * that case the class would be 'block-user'. - * - $title_prefix (array): An array containing additional output populated by - * modules, intended to be displayed in front of the main title tag that - * appears in the template. - * - $title_suffix (array): An array containing additional output populated by - * modules, intended to be displayed after the main title tag that appears in - * the template. - * - * Helper variables: - * - $classes_array: Array of html class attribute values. It is flattened - * into a string within the variable $classes. - * - $block_zebra: Outputs 'odd' and 'even' dependent on each block region. - * - $zebra: Same output as $block_zebra but independent of any block region. - * - $block_id: Counter dependent on each block region. - * - $id: Same output as $block_id but independent of any block region. - * - $is_front: Flags true when presented in the front page. - * - $logged_in: Flags true when the current user is a logged-in member. - * - $is_admin: Flags true when the current user is an administrator. - * - $block_html_id: A valid HTML ID and guaranteed unique. - * - * @ingroup templates - * - * @see bootstrap_preprocess_block() - * @see template_preprocess() - * @see template_preprocess_block() - * @see bootstrap_process_block() - * @see template_process() + * TO DO: Maybe we can remove this, right? We don't guarantee backwards-compatability with cwd_base, so it's just clutter, right...? */ #} {% From f8c3cf38263db230f0b4912957b4118c8e23f651 Mon Sep 17 00:00:00 2001 From: Alison on Ubuntu VM <2660348+alisonjo315@users.noreply.github.com> Date: Fri, 2 Apr 2021 22:51:45 -0400 Subject: [PATCH 2/2] code comments all over menu + block templates; ALSO, removed unused variables (header_id, classes). Some comments relate to https://github.com/CU-CommunityApps/CD-demo/issues/79 ("Main menu / Main navigation block names") --- templates/block--menu-block--main.html.twig | 51 ++++--------------- ...--menu-block--utility-navigation.html.twig | 47 +++-------------- .../block--system-menu-block--main.html.twig | 41 ++------------- templates/block--system-menu-block.html.twig | 6 ++- templates/menu--main.html.twig | 6 ++- templates/menu--section-navigation.html.twig | 25 ++++----- templates/menu--utility-navigation.html.twig | 19 ++----- 7 files changed, 47 insertions(+), 148 deletions(-) diff --git a/templates/block--menu-block--main.html.twig b/templates/block--menu-block--main.html.twig index 1b97c0b..449b840 100644 --- a/templates/block--menu-block--main.html.twig +++ b/templates/block--menu-block--main.html.twig @@ -1,54 +1,21 @@ {# /** * @file - * Theme override for a menu block. + * Theme override for any menu block placement of "main" menu. + * IRL: This template is only used by cwd_*_mainnavigation (on CD Demo), but it + * works fine for any instance of "main" menu placed in sidebar_primary. * - * 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: HTML attributes for the containing element. - * - id: A valid HTML ID and guaranteed unique. - * - title_attributes: HTML attributes for the title element. - * - content_attributes: HTML attributes for the content element. - * - 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. - * - * Headings should be used on navigation menus that consistently appear on - * multiple pages. When this menu block's label is configured to not be - * displayed, it is automatically made invisible using the 'visually-hidden' CSS - * class, which still keeps it visible for screen-readers and assistive - * technology. Headings allow screen-reader and keyboard only users to navigate - * to or skip the links. - * See http://juicystudio.com/article/screen-readers-display-none.php and - * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. + * See @cwd_base/block--system-menu-block.html.twig for available variables and other info. */ #} -{% - set classes = [ - 'block', - 'block-menu', - 'navigation', - 'menu--' ~ derivative_plugin_id|clean_class, - ] -%} -{% set heading_id = attributes.id ~ '-menu'|clean_id %} -{# title_prefix #} +{# Label. #} {% if label %} {{ label }} {% endif %} -{# title_suffix #} diff --git a/templates/block--menu-block--utility-navigation.html.twig b/templates/block--menu-block--utility-navigation.html.twig index 27356e9..b3ce314 100644 --- a/templates/block--menu-block--utility-navigation.html.twig +++ b/templates/block--menu-block--utility-navigation.html.twig @@ -1,48 +1,15 @@ {# /** * @file - * Theme override for a menu block. + * Theme override for any menu block placement of "utility-navigation" menu. + * IRL: This template is only used by cwd_*_utilitynavigation (on CD Demo). * - * 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: HTML attributes for the containing element. - * - id: A valid HTML ID and guaranteed unique. - * - title_attributes: HTML attributes for the title element. - * - content_attributes: HTML attributes for the content element. - * - 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. - * - * Headings should be used on navigation menus that consistently appear on - * multiple pages. When this menu block's label is configured to not be - * displayed, it is automatically made invisible using the 'visually-hidden' CSS - * class, which still keeps it visible for screen-readers and assistive - * technology. Headings allow screen-reader and keyboard only users to navigate - * to or skip the links. - * See http://juicystudio.com/article/screen-readers-display-none.php and - * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. + * See @cwd_base/block--system-menu-block.html.twig for available variables and other info. */ #} -{% - set classes = [ - 'block', - 'block-menu', - 'navigation', - 'menu--' ~ derivative_plugin_id|clean_class, - ] -%} -{% set heading_id = attributes.id ~ '-menu'|clean_id %} diff --git a/templates/block--system-menu-block--main.html.twig b/templates/block--system-menu-block--main.html.twig index 0389da5..25f1a34 100644 --- a/templates/block--system-menu-block--main.html.twig +++ b/templates/block--system-menu-block--main.html.twig @@ -1,45 +1,14 @@ {# /** * @file - * Theme override for a menu block. + * Theme override for any menu block placement of "main" menu. + * IRL: Only meant for cwd_*_main_menu block. + * 💬 This menu block is a core menu block, not a menu_block module menu block, so there's no theme hook suggestion setting to target it more specifically. Should we redo the main menu block with the menu_block module? Maybe! Not sure it's worth the trouble it would cause, but I think it's worth considering. + * Related: https://github.com/CU-CommunityApps/CD-demo/issues/79 * - * 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: HTML attributes for the containing element. - * - id: A valid HTML ID and guaranteed unique. - * - title_attributes: HTML attributes for the title element. - * - content_attributes: HTML attributes for the content element. - * - 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. - * - * Headings should be used on navigation menus that consistently appear on - * multiple pages. When this menu block's label is configured to not be - * displayed, it is automatically made invisible using the 'visually-hidden' CSS - * class, which still keeps it visible for screen-readers and assistive - * technology. Headings allow screen-reader and keyboard only users to navigate - * to or skip the links. - * See http://juicystudio.com/article/screen-readers-display-none.php and - * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. + * See @cwd_base/block--system-menu-block.html.twig for available variables and other info. */ #} -{% - set classes = [ - 'block', - 'block-menu', - 'navigation', - 'menu--' ~ derivative_plugin_id|clean_class, - ] -%} -{% set heading_id = attributes.id ~ '-menu'|clean_id %}