function ThemePreprocess::preprocessMaintenanceTaskList
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/
lib/ Drupal/ Core/ Theme/ ThemePreprocess.php, line 781
Class
- ThemePreprocess
- Preprocess for common/core theme templates.
Namespace
Drupal\Core\ThemeCode
public function preprocessMaintenanceTaskList(array &$variables) : void {
$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'] = $this->t('active');
$done = FALSE;
}
else {
if ($done) {
$variables['tasks'][$k]['attributes']->addClass('done');
$variables['tasks'][$k]['status'] = $this->t('done');
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.