function template_preprocess_uikit_alert in UIkit Components 8.3
Prrpares variables for UIkit Alert templates.
Default template: uikit-alert.html.twig.
Parameters
$variables:: An associative array containing:
- element: An associative array containing:
- #message: The message to display in the alert.
- #style: The style of the alert. Possible values:
- primary: Give the message a prominent styling.
- success: Indicates success or a positive message.
- warning: Indicates a message containing a warning.
- danger: Indicates an important or error message.
Defaults to "primary".
- #close_button: Boolean indicating whether to include a close button in the alert. Defaults to FALSE.
See also
\Drupal\uikit_components\Element\UIkitAlert
https://getuikit.com/docs/alert
Related topics
File
- includes/
preprocess.inc, line 72 - Set up variables to be placed within the template (.html.twig) files.
Code
function template_preprocess_uikit_alert(&$variables) {
$element = $variables['element'];
// Set the attributes for the alert.
$variables['attributes'] = $element['#attributes'];
// Set the properties for the alert.
$variables['message'] = $element['#message'];
$variables['style'] = $element['#style'];
$variables['close_button'] = $element['#close_button'];
}