diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 4c0e580..6996a8c 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -3226,12 +3226,16 @@ function drupal_common_theme() {
),
'task_list' => array(
'variables' => array('items' => NULL, 'active' => NULL),
+ 'preprocess functions' => array('template_preprocess_task_list'),
+ 'template' => 'task-list',
),
'authorize_message' => array(
'variables' => array('message' => NULL, 'success' => TRUE),
+ 'template' => 'authorize-message',
),
'authorize_report' => array(
'variables' => array('messages' => array()),
+ 'template' => 'authorize-report',
),
// From pager.inc.
'pager' => array(
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index cda4109..6d49b56 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -5,6 +5,8 @@
* Theming for maintenance pages.
*/
+use Drupal\Core\Template\Attribute;
+
/**
* Sets up the theming system for maintenance page.
*
@@ -107,42 +109,38 @@ function _theme_load_offline_registry($theme, $base_theme = NULL, $theme_engine
}
/**
- * Returns HTML for a list of maintenance tasks to perform.
+ * Prepares variables for maintenance task list templates.
*
- * @param $variables
+ * Default template: task-list.html.twig.
+ *
+ * @param array $variables
* An associative array containing:
* - items: An associative array of maintenance tasks.
* - active: The key for the currently active maintenance task.
- *
- * @ingroup themeable
*/
-function theme_task_list($variables) {
+function template_preprocess_task_list(&$variables) {
$t = get_t();
$items = $variables['items'];
$active = $variables['active'];
$done = isset($items[$active]) || $active == NULL;
- $output = '
Installation tasks
';
- $output .= '';
+ $tasks = array();
foreach ($items as $k => $item) {
+ $tasks[$k]['item'] = $item;
+ $tasks[$k]['attributes'] = new Attribute(array('class' => array()));
if ($active == $k) {
- $class = 'active';
- $status = '(' . $t('active') . ')';
+ $tasks[$k]['attributes']['class'][] = 'active';
+ $tasks[$k]['status'] = $t('active');
$done = FALSE;
}
else {
- $class = $done ? 'done' : '';
- $status = $done ? '(' . $t('done') . ')' : '';
+ $tasks[$k]['attributes']['class'][] = $done ? 'done' : '';
+ $tasks[$k]['status'] = $done ? $t('done') : '';
}
- $output .= '- ';
- $output .= $item;
- $output .= ($status ? '' . $status . '' : '');
- $output .= '
';
}
- $output .= '
';
- return $output;
+
+ $variables['tasks'] = $tasks;
}
/**
@@ -176,52 +174,43 @@ function theme_update_page($variables) {
}
/**
- * Returns HTML for a results report of an operation run by authorize.php.
+ * Prepares variables for authorize.php operation report templates.
*
- * @param $variables
+ * This report displays the results of an operation run via authorize.php.
+ *
+ * Default template: authorize-report.html.twig.
+ *
+ * @param array $variables
* An associative array containing:
* - messages: An array of result messages.
- *
- * @ingroup themeable
*/
-function theme_authorize_report($variables) {
+function template_preprocess_authorize_report(&$variables) {
$messages = $variables['messages'];
- $output = '';
+ // Top level attributes.
+ $attributes = $variables['attributes'] ? $variables['attributes'] : array();
+ $variables['attributes'] = new Attribute($attributes);
+
if (!empty($messages)) {
- $output .= '';
+ $lists = array();
+ $variables['attributes']['id'] = 'authorize-results';
foreach ($messages as $heading => $logs) {
$items = array();
foreach ($logs as $number => $log_message) {
if ($number === '#abort') {
continue;
}
- $items[] = theme('authorize_message', array('message' => $log_message['message'], 'success' => $log_message['success']));
+ $items[] = array(
+ '#theme' => 'authorize_message',
+ '#message' => $log_message['message'],
+ '#success' => $log_message['success'],
+ );
}
- $output .= theme('item_list', array('items' => $items, 'title' => $heading));
+ $lists[] = array(
+ '#theme' => 'item_list',
+ '#items' => $items,
+ '#title' => $heading,
+ );
}
- $output .= '
';
- }
- return $output;
-}
-
-/**
- * Returns HTML for a single log message from the authorize.php batch operation.
- *
- * @param $variables
- * An associative array containing:
- * - message: The log message.
- * - success: A boolean indicating failure or success.
- *
- * @ingroup themeable
- */
-function theme_authorize_message($variables) {
- $message = $variables['message'];
- $success = $variables['success'];
- if ($success) {
- $item = array('data' => $message, 'class' => array('success'));
- }
- else {
- $item = array('data' => '' . $message . '', 'class' => array('failure'));
+ $variables['report'] = $lists;
}
- return $item;
}
diff --git a/core/modules/system/templates/authorize-message.html.twig b/core/modules/system/templates/authorize-message.html.twig
new file mode 100644
index 0000000..55623dc
--- /dev/null
+++ b/core/modules/system/templates/authorize-message.html.twig
@@ -0,0 +1,22 @@
+{#
+/**
+ * @file
+ * Default theme implementation for a log message in an authorize.php report.
+ *
+ * This template displays a single message in an authorize.php batch operation
+ * report.
+ *
+ * Available variables:
+ * - message: The log message.
+ * - success: A flag indicating failure or success.
+ *
+ * @see template_preprocess()
+ *
+ * @ingroup themeable
+ */
+#}
+{% if success %}
+ {{ message }}
+{% else %}
+ {{ message }}
+{% endif %}
diff --git a/core/modules/system/templates/authorize-report.html.twig b/core/modules/system/templates/authorize-report.html.twig
new file mode 100644
index 0000000..09bcdf0
--- /dev/null
+++ b/core/modules/system/templates/authorize-report.html.twig
@@ -0,0 +1,24 @@
+{#
+/**
+ * @file
+ * Default theme implementation for authorize.php operation report templates.
+ *
+ * This report displays the results of an operation run via authorize.php.
+ *
+ * Available variables:
+ * - report: A list of result messages.
+ * - attributes: HTML attributes for the element.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_authorize_report()
+ *
+ * @ingroup themeable
+ */
+#}
+{% if report %}
+
+ {% for messages in report %}
+ {{ messages }}
+ {% endfor %}
+
+{% endif %}
diff --git a/core/modules/system/templates/maintenance-page.html.twig b/core/modules/system/templates/maintenance-page.html.twig
new file mode 100644
index 0000000..a57b546
--- /dev/null
+++ b/core/modules/system/templates/maintenance-page.html.twig
@@ -0,0 +1,92 @@
+{#
+/**
+ * @file
+ * Default theme implementation to display a single Drupal page while offline.
+ *
+ * All the available variables are mirrored in html.html.twig and
+ * page.html.twig.
+ * Some may be blank but they are provided for consistency.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_maintenance_page()
+ *
+ * @ingroup themeable
+ */
+#}
+
+
+
+ {{ head_title }}
+ {{ head }}
+ {{ styles }}
+ {{ scripts }}
+
+
+
+
+
+
+
+ {% if sidebar_first %}
+
+ {{ sidebar_first }}
+
+ {% endif %}
+
+
+
+
+ {% if title %}
{{ title }}
{% endif %}
+ {% if messages %}{{ messages }}{% endif %}
+
+ {{ content }}
+
+
+
+
+
+ {% if sidebar_second %}
+
+ {{ sidebar_second }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
diff --git a/core/modules/system/templates/maintenance-page.tpl.php b/core/modules/system/templates/maintenance-page.tpl.php
deleted file mode 100644
index 5da7a1a..0000000
--- a/core/modules/system/templates/maintenance-page.tpl.php
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/core/modules/system/templates/task-list.html.twig b/core/modules/system/templates/task-list.html.twig
new file mode 100644
index 0000000..64c3e77
--- /dev/null
+++ b/core/modules/system/templates/task-list.html.twig
@@ -0,0 +1,27 @@
+{#
+/**
+ * @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'.
+ *
+ * @see template_preprocess()
+ *
+ * @ingroup themeable
+ */
+#}
+Installation tasks
+
+{% for task in tasks %}
+ -
+ {{- task.item -}}
+ {%- if task.status %} ({{ task.status }}){% endif -%}
+
+{% endfor %}
+