summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2014-09-08 18:10:15 (GMT)
committerwebchick2014-09-08 18:10:15 (GMT)
commitdf9431d7ae5322fbb161fdbb098d30ef4fe3986e (patch)
tree633bde012f8c847d105d8abdf26aad084d78f68f
parent946aee4fab686f7f57d4539f38a9d4060a1d3876 (diff)
Revert "Issue #1885564 by Cottser, SebCorbin, joelpittet, drupalninja99, jenlampton, longwave, aboros, trevorkjorlien, socketwench, shanethehat, mbrett5062, rteijeiro: Convert theme_task_list to Twig template."
Wrong issue number; correcting... This reverts commit 511d9f79bfac4914d24d3265d08a0c08da654f87.
-rw-r--r--core/includes/theme.inc34
-rw-r--r--core/modules/system/templates/task-list.html.twig25
2 files changed, 20 insertions, 39 deletions
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index fc70f82..461ece9 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1562,38 +1562,45 @@ function template_preprocess_container(&$variables) {
$variables['attributes'] = $element['#attributes'];
}
+
/**
- * Prepares variables for maintenance task list templates.
- *
- * Default template: task-list.html.twig.
+ * Returns HTML for a list of maintenance tasks to perform.
*
- * @param array $variables
+ * @param $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.
+ *
+ * @ingroup themeable
*/
-function template_preprocess_task_list(&$variables) {
+function theme_task_list($variables) {
$items = $variables['items'];
$active = $variables['active'];
$done = isset($items[$active]) || $active == NULL;
+ $output = '<h2 class="visually-hidden">Installation tasks</h2>';
+ $output .= '<ol class="task-list">';
+
foreach ($items as $k => $item) {
- $variables['tasks'][$k]['item'] = $item;
- $variables['tasks'][$k]['attributes'] = new Attribute();
if ($active == $k) {
- $variables['tasks'][$k]['attributes']->addClass('active');
- $variables['tasks'][$k]['status'] = t('active');
+ $class = 'active';
+ $status = '(' . t('active') . ')';
$done = FALSE;
}
else {
- if ($done) {
- $variables['tasks'][$k]['attributes']->addClass('done');
- $variables['tasks'][$k]['status'] = t('done');
- }
+ $class = $done ? 'done' : '';
+ $status = $done ? '(' . t('done') . ')' : '';
}
+ $output .= '<li';
+ $output .= ($class ? ' class="' . $class . '"' : '') . '>';
+ $output .= $item;
+ $output .= ($status ? '<span class="visually-hidden"> ' . $status . '</span>' : '');
+ $output .= '</li>';
}
+ $output .= '</ol>';
+ return $output;
}
/**
@@ -2354,7 +2361,6 @@ function drupal_common_theme() {
),
'task_list' => array(
'variables' => array('items' => NULL, 'active' => NULL, 'variant' => NULL),
- 'template' => 'task-list',
),
'authorize_message' => array(
'variables' => array('message' => NULL, 'success' => TRUE),
diff --git a/core/modules/system/templates/task-list.html.twig b/core/modules/system/templates/task-list.html.twig
deleted file mode 100644
index 649cfa6..0000000
--- a/core/modules/system/templates/task-list.html.twig
+++ /dev/null
@@ -1,25 +0,0 @@
-{#
-/**
- * @file
- * Default theme implementation for a list of maintenance tasks to perform.
- *
- * Available variables:
- * - tasks: A list of maintenance tasks to perform. Each item in the list has
- * the following variables:
- * - item: The maintenance task.
- * - attributes: HTML attributes for the maintenance task.
- * - status: (optional) Text describing the status of the maintenance task,
- * 'active' or 'done'.
- *
- * @ingroup themeable
- */
-#}
-<h2 class="visually-hidden">Installation tasks</h2>
-<ol class="task-list">
-{% for task in tasks %}
- <li{{ task.attributes }}>
- {{ task.item }}
- {% if task.status %}<span class="visually-hidden"> ({{ task.status }})</span>{% endif %}
- </li>
-{% endfor %}
-</ol>