Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use aria labelled by on blocks to help with association.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{# | ||
/** | ||
* @file | ||
* Theme override 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. | ||
* - 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 template_preprocess_block() | ||
*/ | ||
#} | ||
{% set heading_id = attributes.id ~ '-heading'|clean_id %} | ||
{% set cta_id = attributes.id ~ '-cta'|clean_id %} | ||
|
||
<section{{ attributes }}> | ||
{{ title_prefix }} | ||
{% if label %} | ||
<h2{{ title_attributes.setAttribute('id', heading_id) }}>{{ label }}</h2> | ||
{% endif %} | ||
{{ title_suffix }} | ||
|
||
<div{{ content_attributes }}> | ||
{% block content %} | ||
{{ content|without('field_call_to_action') }} | ||
{% endblock %} | ||
</div> | ||
|
||
{% if content.field_call_to_action %}{% spaceless %} | ||
<a | ||
id="{{ cta_id }}" | ||
class="btn btn-default" | ||
href="{{ content.field_call_to_action[0]['#url'] }}" | ||
aria-labelledby="{{ cta_id }} {{ heading_id }}"> | ||
|
||
{{ content.field_call_to_action[0]['#title'] }} | ||
</a> | ||
{% endspaceless %}{% endif %} | ||
|
||
</section> |