diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 4a6005d..6cdef50 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -125,36 +125,36 @@ function theme_admin_block($variables) {
}
/**
- * Returns HTML for the content of an administrative block.
+ * Prepares variables for administrative content block templates.
+ *
+ * Default template: admin-block-content.html.twig.
*
* @param $variables
* An associative array containing:
* - 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
+ * contain the keys 'title', 'link_path', and 'localized_options', which are
* passed to l(). A 'description' key may also be provided.
*
* @ingroup themeable
*/
-function theme_admin_block_content($variables) {
- $content = $variables['content'];
- $output = '';
-
- if (!empty($content)) {
- $class = 'admin-list';
- if ($compact = system_admin_compact_mode()) {
- $class .= ' compact';
+function template_preprocess_admin_block_content(&$variables) {
+ if (!empty($variables['content'])) {
+ $compact = system_admin_compact_mode();
+ $variables['attributes'] = array('class' => array('admin-list'));
+ if ($compact) {
+ $variables['attributes']['class'][] = 'compact';
}
- $output .= '
';
- foreach ($content as $item) {
- $output .= '- ' . l($item['title'], $item['link_path'], $item['localized_options']) . '
';
+ foreach ($variables['content'] as $key => $item) {
+ $variables['content'][$key]['link'] = l($item['title'], $item['link_path'], $item['localized_options']);
if (!$compact && isset($item['description'])) {
- $output .= '- ' . filter_xss_admin($item['description']) . '
';
+ $variables['content'][$key]['description'] = filter_xss_admin($item['description']);
+ }
+ else {
+ $variables['content'][$key]['description'] = FALSE;
}
}
- $output .= '
';
}
- return $output;
}
/**
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 1657f9f..8be2750 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -193,6 +193,7 @@ function system_theme() {
'admin_block_content' => array(
'variables' => array('content' => NULL),
'file' => 'system.admin.inc',
+ 'template' => 'admin-block-content',
),
'system_admin_index' => array(
'variables' => array('menu_items' => NULL),
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..30a9ca1
--- /dev/null
+++ b/core/modules/system/templates/admin-block-content.html.twig
@@ -0,0 +1,27 @@
+{#
+/**
+ * @file
+ * Default theme implementation for the content of an administrative block.
+ *
+ * Available variables:
+ * - content: A list containing information about the block. Each element
+ * of the array represents an administrative menu item, and must at least
+ * contain the keys 'title', 'link_path', and 'localized_options', which are
+ * passed to l(). A 'description' key may also be provided.
+ * - attributes: HTML attributes to be aded to the element.
+ *
+ * @see template_preprocess_admin_block_content()
+ *
+ * @ingroup themeable
+ */
+#}
+{% if content %}
+
+ {% for item in content %}
+ - {{ item.link }}
+ {% if item.description %}
+ - {{ item.description }}
+ {% endif %}
+ {% endfor %}
+
+{% endif %}