function template_preprocess_maintenance_task_list
Same name in other branches
- 9 core/includes/theme.inc \template_preprocess_maintenance_task_list()
- 10 core/includes/theme.inc \template_preprocess_maintenance_task_list()
- 11.x core/includes/theme.inc \template_preprocess_maintenance_task_list()
Prepares variables for maintenance task list templates.
Default template: maintenance-task-list.html.twig.
Parameters
array $variables: An associative array containing:
- items: An associative array of maintenance tasks. It's the caller's responsibility to ensure this array's items contain no dangerous HTML such as <script> tags.
- active: The key for the currently active maintenance task.
File
-
core/
includes/ theme.inc, line 1195
Code
function template_preprocess_maintenance_task_list(&$variables) {
$items = $variables['items'];
$active = $variables['active'];
$done = isset($items[$active]) || $active == NULL;
foreach ($items as $k => $item) {
$variables['tasks'][$k]['item'] = $item;
$variables['tasks'][$k]['attributes'] = new Attribute();
if ($active == $k) {
$variables['tasks'][$k]['attributes']->addClass('is-active');
$variables['tasks'][$k]['status'] = t('active');
$done = FALSE;
}
else {
if ($done) {
$variables['tasks'][$k]['attributes']->addClass('done');
$variables['tasks'][$k]['status'] = t('done');
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.