diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 3af30c8..b5251e2 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -284,44 +284,6 @@ function system_sort_themes($a, $b) { } /** - * Returns HTML for an administrative block for display. - * - * @param $variables - * An associative array containing: - * - block: An array containing information about the block: - * - show: A Boolean whether to output the block. Defaults to FALSE. - * - title: The block's title. - * - content: (optional) Formatted content for the block. - * - description: (optional) Description of the block. Only output if - * 'content' is not set. - * - * @ingroup themeable - */ -function theme_admin_block($variables) { - $block = $variables['block']; - $output = ''; - - // Don't display the block if it has no content to display. - if (empty($block['show'])) { - return $output; - } - - $output .= '
'; - if (!empty($block['title'])) { - $output .= '

' . $block['title'] . '

'; - } - if (!empty($block['content'])) { - $output .= '
' . render($block['content']) . '
'; - } - else { - $output .= '
' . $block['description'] . '
'; - } - $output .= '
'; - - return $output; -} - -/** * Returns HTML for the content of an administrative block. * * @param $variables diff --git a/core/modules/system/system.module b/core/modules/system/system.module index ee3466d..e7ae675 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -174,6 +174,7 @@ function system_theme() { 'admin_block' => array( 'variables' => array('block' => NULL), 'file' => 'system.admin.inc', + 'template' => 'admin-block', ), 'admin_block_content' => array( 'variables' => array('content' => NULL), 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..c74e90d --- /dev/null +++ b/core/modules/system/templates/admin-block.html.twig @@ -0,0 +1,28 @@ +{# +/** + * @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). + * + * @ingroup themeable + */ +#} +{% if block.show %} +
+ {% if block.title %} +

{{ block.title }}

+ {% endif %} + {% if block.content %} +
{{ block.content }}
+ {% elseif block.description %} +
{{ block.description }}
+ {% endif %} +
+{% endif %}