diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index dbdf6a5..c9f9632 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -5,10 +5,11 @@
* Admin page callbacks for the system module.
*/
+use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Template\Attribute;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
-use Drupal\Core\Datetime\DrupalDateTime;
/**
* Menu callback; Provide the administration overview page.
@@ -42,10 +43,11 @@ function system_admin_config_page() {
unset($item['localized_options']['attributes']['title']);
}
$block = $item;
- $block['content'] = '';
- $block['content'] .= theme('admin_block_content', array('content' => system_admin_menu_block($item)));
- if (!empty($block['content'])) {
- $block['show'] = TRUE;
+ if ($content = system_admin_menu_block($item)) {
+ $block['content'] = array(
+ '#theme' => 'admin_block_content',
+ '#content' => $content
+ );
}
// Prepare for sorting as in function _menu_tree_check_access().
@@ -56,7 +58,10 @@ function system_admin_config_page() {
}
if ($blocks) {
ksort($blocks);
- return theme('admin_page', array('blocks' => $blocks));
+ return array(
+ '#theme' => 'admin_page',
+ '#blocks' => $blocks
+ );
}
else {
return t('You do not have any administrative items.');
@@ -77,12 +82,17 @@ function system_admin_config_page() {
function system_admin_menu_block_page() {
$item = menu_get_item();
if ($content = system_admin_menu_block($item)) {
- $output = theme('admin_block_content', array('content' => $content));
+ $build = array(
+ '#theme' => 'admin_block_content',
+ '#content' => $content
+ );
}
else {
- $output = t('You do not have any administrative items.');
+ $build = array(
+ '#markup' => t('You do not have any administrative items.'),
+ );
}
- return $output;
+ return $build;
}
/**
@@ -113,7 +123,10 @@ function system_admin_index() {
$menu_items[$info->info['name']] = array($info->info['description'], $admin_tasks);
}
}
- return theme('system_admin_index', array('menu_items' => $menu_items));
+ return array(
+ '#theme' => 'system_admin_index',
+ '#menu_items' => $menu_items
+ );
}
/**
@@ -242,8 +255,12 @@ function system_themes_page() {
uasort($theme_groups['enabled'], 'system_sort_themes');
drupal_alter('system_themes_page', $theme_groups);
- $admin_form = drupal_get_form('system_themes_admin_form', $admin_theme_options);
- return theme('system_themes_page', array('theme_groups' => $theme_groups, 'theme_group_titles' => $theme_group_titles)) . drupal_render($admin_form);
+ return array(
+ '#theme' => 'system_themes_page',
+ '#theme_groups' => $theme_groups,
+ '#theme_group_titles' => $theme_group_titles,
+ '#admin_theme_options' => $admin_theme_options,
+ );
}
/**
@@ -1057,9 +1074,12 @@ function _system_modules_build_row($info, $extra) {
}
else {
$form['enable'] = array(
- '#markup' => theme('image', array('uri' => 'core/misc/watchdog-error.png', 'alt' => $status_short, 'title' => $status_short)),
+ '#theme' => 'image',
+ '#uri' => 'core/misc/watchdog-error.png',
+ '#alt' => $status_short,
+ '#title' => $status_short
);
- $form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long));
+ $form['description']['#markup'] .= '
' . $status_long . '
';
}
// Build operation links.
@@ -1103,7 +1123,10 @@ function system_modules_confirm_form($modules, $storage) {
$items[] = format_plural(count($info['depends']), 'The @module module is missing, so the following module will be disabled: @depends.', 'The @module module is missing, so the following modules will be disabled: @depends.', $t_argument);
}
- $form['text'] = array('#markup' => theme('item_list', array('items' => $items)));
+ $form['text'] = array(
+ '#theme' => 'item_list',
+ '#items' => $items,
+ );
// Set some default form values
$form = confirm_form(
@@ -1355,7 +1378,13 @@ function system_modules_uninstall_confirm_form($storage) {
if (isset($uninstall)) {
$form['#confirmed'] = TRUE;
$form['uninstall']['#tree'] = TRUE;
- $form['modules'] = array('#markup' => '
' . t('The following modules will be completely uninstalled from your site, and all data from these modules will be lost!') . '
';
-
- return $output;
}
/**
- * Returns HTML for the status report.
+ * Preprocess variables for status-report.html.twig
*
* @param $variables
* An associative array containing:
* - requirements: An array of requirements.
+ * Properties used: severity.title, severity.class,
+ * requirement.title, requirement.value, requirement.description
*
* @ingroup themeable
*/
-function theme_status_report($variables) {
- $requirements = $variables['requirements'];
+function template_preprocess_status_report(&$variables) {
$severities = array(
REQUIREMENT_INFO => array(
'title' => t('Info'),
@@ -2354,11 +2348,8 @@ function theme_status_report($variables) {
'class' => 'error',
),
);
- $output = '
';
- $output .= '
' . t('Status') . '
' . t('Component') . '
' . t('Details') . '
';
- $output .= '
';
- foreach ($requirements as $requirement) {
+ foreach ($variables['requirements'] as $i => $requirement) {
if (empty($requirement['#type'])) {
// Always use the explicit requirement severity, if defined. Otherwise,
// default to REQUIREMENT_OK in the installer to visually confirm that
@@ -2374,26 +2365,14 @@ function theme_status_report($variables) {
$severity = $severities[REQUIREMENT_INFO];
}
- $severity['icon'] = '
';
+ $current_theme['attributes'] = new Attribute(array('class' => $theme->classes));
+ $current_theme['name'] = $theme->info['name'];
+ $current_theme['version'] = isset($theme->info['version']) ? $theme->info['version'] : '';
+ $current_theme['notes'] = count($theme->notes) ? '(' . join(', ', $theme->notes) . ')' : '';
// Make sure to provide feedback on compatibility.
if (!empty($theme->incompatible_core)) {
- $output .= '
' . t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => DRUPAL_CORE_COMPATIBILITY)) . '
';
+ $current_theme['compatibility'] = t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => DRUPAL_CORE_COMPATIBILITY));
}
elseif (!empty($theme->incompatible_php)) {
if (substr_count($theme->info['php'], '.') < 2) {
$theme->info['php'] .= '.*';
}
- $output .= '
' . t('This theme requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $theme->info['php'], '!php_version' => phpversion())) . '
';
+ $current_theme['compatibility'] = t('This theme requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $theme->info['php'], '!php_version' => phpversion()));
}
elseif (!empty($theme->incompatible_base)) {
- $output .= '
' . t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => $theme->info['base theme'])) . '
';
+ $current_theme['compatibility'] = t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => $theme->info['base theme']));
}
elseif (!empty($theme->incompatible_engine)) {
- $output .= '
' . t('This theme requires the theme engine @theme_engine to operate correctly.', array('@theme_engine' => $theme->info['engine'])) . '
';
-
- return $output;
}
/**
@@ -3914,8 +3931,9 @@ function system_archiver_info() {
*
* @ingroup themeable
*/
-function theme_confirm_form($variables) {
- return drupal_render_children($variables['form']);
+function template_preprocess_confirm_form(&$variables) {
+ // @todo Resolve this http://drupal.org/node/1920886
+ $variables['form'] = drupal_render_children($variables['form']);
}
/**
@@ -3930,8 +3948,9 @@ function theme_confirm_form($variables) {
*
* @ingroup themeable
*/
-function theme_system_settings_form($variables) {
- return drupal_render_children($variables['form']);
+function template_preprocess_system_settings_form(&$variables) {
+ // @todo Resolve this http://drupal.org/node/1920886
+ $variables['form'] = drupal_render_children($variables['form']);
}
/**
@@ -3945,6 +3964,7 @@ function theme_system_settings_form($variables) {
* A string containing an HTML-formatted form.
*
* @ingroup themeable
+ * @todo Move this out of system.module and back into theme.inc.
*/
function theme_exposed_filters($variables) {
$form = $variables['form'];
diff --git a/core/modules/system/templates/admin-block-content.html.twig b/core/modules/system/templates/admin-block-content.html.twig
new file mode 100644
index 0000000..80c0526
--- /dev/null
+++ b/core/modules/system/templates/admin-block-content.html.twig
@@ -0,0 +1,29 @@
+{#
+/**
+ * @file
+ * Default theme implementation for the content of an administrative block.
+ *
+ * Available variables:
+ * - content: An array containing information about the block. Each element
+ * of the array represents an administrative menu item, and must at least
+ * contain the keys 'title', 'href', and 'localized_options', which are
+ * passed to l(). A 'description' key may also be provided.
+ * - attributes: Remaining HTML attributes to be aded to the element.
+ * - is_compact_mode: It defines if compact mode is used.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_admin_block_content()
+ *
+ * @ingroup themeable
+ */
+#}
+{% if content %}
+
+ {% for item in content %}
+
{{ item.link }}
+ {% if item.description %}
+
{{ item.description }}
+ {% endif %}
+ {% endfor %}
+
+{% endif %}
diff --git a/core/modules/system/templates/admin-block.html.twig b/core/modules/system/templates/admin-block.html.twig
new file mode 100644
index 0000000..986b959
--- /dev/null
+++ b/core/modules/system/templates/admin-block.html.twig
@@ -0,0 +1,26 @@
+{#
+/**
+ * @file
+ * Default theme implementation for an administrative block.
+ *
+ * Available variables:
+ * - block: An array of information about the block, including:
+ * - show: A boolean flag indicating if the block should be displayed.
+ * - title: The block title.
+ * - content: (optional) The content of the block.
+ * - description: (optional) A description of the block.
+ * (description should only be output if content is not available).
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_admin_block()
+ *
+ * @ingroup themeable
+ */
+#}
+{% if block.show %}
+
+ {% if block.title %}
{{ block.title }}
{% endif %}
+ {% if block.content %}
{{ block.content }}
+ {% elseif block.description %}
{{ block.description }}
{% endif %}
+
+{% endif %}
diff --git a/core/modules/system/templates/admin-page.html.twig b/core/modules/system/templates/admin-page.html.twig
new file mode 100644
index 0000000..ab16d6e
--- /dev/null
+++ b/core/modules/system/templates/admin-page.html.twig
@@ -0,0 +1,25 @@
+{#
+/**
+ * @file
+ * Default theme implementation for an administrative page.
+ *
+ * Available variables:
+ * - system_compact_link: Themed link to toggle compact view.
+ * - containers: An array of administrative blocks keyed by position: left or right.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_admin_page()
+ *
+ * @ingroup themeable
+ */
+#}
+
+ {{ system_compact_link }}
+ {% for position, container in containers %}
+
+ {% for i in container.blocks|keys %}
+ {{ container.blocks[i] }}
+ {% endfor %}
+
+ {% endfor %}
+
diff --git a/core/modules/system/templates/confirm-form.html.twig b/core/modules/system/templates/confirm-form.html.twig
new file mode 100644
index 0000000..ba541de
--- /dev/null
+++ b/core/modules/system/templates/confirm-form.html.twig
@@ -0,0 +1,18 @@
+{#
+/**
+ * @file
+ * Default theme implementation for a confirmation form.
+ *
+ * By default this does not alter the appearance of a form at all,
+ * but is provided as a convenience for themers.
+ *
+ * Available variables:
+ * - form: A render element representing the form.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_confirm_form()
+ *
+ * @ingroup themeable
+ */
+#}
+{{ form }}
diff --git a/core/modules/system/templates/datetime.html.twig b/core/modules/system/templates/datetime.html.twig
deleted file mode 100644
index 5ea386e..0000000
--- a/core/modules/system/templates/datetime.html.twig
+++ /dev/null
@@ -1,28 +0,0 @@
-{#
-/**
- * Returns HTML for a date / time.
- *
- * Available variables
- * - timestamp: (optional) A UNIX timestamp for the datetime attribute. If the
- * datetime cannot be represented as a UNIX timestamp, use a valid datetime
- * attribute value in attributes.datetime.
- * - text: (optional) The content to display within the