1 system.theme.inc | theme_admin_block($variables) |
Returns HTML for an administrative block for display.
Parameters
$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.
- icon: (optional) The block's icon.
- content: (optional) Formatted content for the block.
- description: (optional) Description of the block. Only output if 'content' is not set.
Related topics
File
- core/
modules/ system/ system.theme.inc, line 470 - Theme functions for the System module.
Code
function theme_admin_block($variables) {
$block = $variables['block'];
$classes = array('admin-panel');
// Construct a more specific class.
if (isset($variables['block']['path'])) {
$path_parts = explode('/', $variables['block']['path']);
$class_suffix = end($path_parts);
$classes[] = ' ' . backdrop_clean_css_identifier('admin-panel-' . $class_suffix);
}
$output = '';
// Don't display the block if it has no content to display.
if (empty($block['show'])) {
return $output;
}
$output .= '<div class="' . implode(' ', $classes) . '">';
if (!empty($block['title'])) {
$icon = empty($block['icon']) ? '' : '<span class="admin-panel-icon">' . icon($block['icon']) . '</span>';
$title = '<span class="admin-panel-title">' . $block['title'] . '</span>';
$output .= '<h3>' . $icon . $title . '</h3>';
}
if (!empty($block['content'])) {
$output .= '<div class="body">' . $block['content'] . '</div>';
}
else {
$output .= '<div class="description">' . $block['description'] . '</div>';
}
$output .= '</div>';
return $output;
}