function template_preprocess_amp_sidebar in Accelerated Mobile Pages (AMP) 8.3
Prepares variables for AMP Sidebar Element.
Default template: amp-sidebar.html.twig.
Parameters
array $variables: An associative array containing:
- #id: The id of the sidebar (used by the toggle and close buttons).
- #tabindex: The number of the tabindex.
- #attributes: Attributes for the container.
- #content_attributes: Attributes for the close button.
File
- ./
amp.theme.inc, line 74 - Preprocessors and helper functions to make theming easier.
Code
function template_preprocess_amp_sidebar(&$variables) {
$element = $variables['element'];
// Ensure #attributes are set.
$element += [
'#attributes' => [],
'#content_attributes' => [],
];
$variables['attributes'] = $element['#attributes'];
$variables['content_attributes'] = $element['#content_attributes'];
$variables['tabindex'] = $element['#tabindex'];
$variables['id'] = $element['#id'];
$variables['children'] = $element['#children'];
}