Issue #1939066 by joelpittet, chrisjlee, Cottser, splatio, jenlampton: Convert theme_breadcrumb() to Twig.
parent
0360c07ec1
commit
2c67e9019e
|
@ -1835,27 +1835,6 @@ function theme_image($variables) {
|
|||
return '<img' . new Attribute($attributes) . ' />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for a breadcrumb trail.
|
||||
*
|
||||
* @param $variables
|
||||
* An associative array containing:
|
||||
* - breadcrumb: An array containing the breadcrumb links.
|
||||
*/
|
||||
function theme_breadcrumb($variables) {
|
||||
$breadcrumb = $variables['breadcrumb'];
|
||||
$output = '';
|
||||
if (!empty($breadcrumb)) {
|
||||
$output .= '<nav role="navigation" class="breadcrumb">';
|
||||
// Provide a navigational heading to give context for breadcrumb links to
|
||||
// screen-reader users. Make the heading invisible with .visually-hidden.
|
||||
$output .= '<h2 class="visually-hidden">' . t('You are here') . '</h2>';
|
||||
$output .= '<ol><li>' . implode('</li><li>', $breadcrumb) . '</li></ol>';
|
||||
$output .= '</nav>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* #pre_render callback to transform children of an element into #rows suitable for theme_table().
|
||||
*
|
||||
|
@ -3146,6 +3125,7 @@ function drupal_common_theme() {
|
|||
),
|
||||
'breadcrumb' => array(
|
||||
'variables' => array('breadcrumb' => NULL),
|
||||
'template' => 'breadcrumb',
|
||||
),
|
||||
'table' => array(
|
||||
'variables' => array('header' => NULL, 'rows' => NULL, 'attributes' => array(), 'caption' => NULL, 'colgroups' => array(), 'sticky' => TRUE, 'responsive' => TRUE, 'empty' => ''),
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
{#
|
||||
/**
|
||||
* @file
|
||||
* Default theme implementation for a breadcrumb trail.
|
||||
*
|
||||
* Available variables:
|
||||
* - breadcrumb: Breadcrumb trail items.
|
||||
*
|
||||
* @see template_preprocess()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
{% if breadcrumb %}
|
||||
<nav class="breadcrumb" role="navigation">
|
||||
<h2 class="visually-hidden">{{ 'You are here'|t }}</h2>
|
||||
<ol>
|
||||
{% for item in breadcrumb %}
|
||||
<li>{{ item }}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</nav>
|
||||
{% endif %}
|
Loading…
Reference in New Issue