/**
 * Override or insert variables into the block templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("block" in this case.)
 */
function framework_preprocess_block(&$vars, $hook)
{
    $block = $vars['block'];
    // Drupal 7 uses a $content variable instead of $block->content.
    $vars['content'] = $block->content;
    // Drupal 7 should use a $title variable instead of $block->subject.
    $vars['title'] = $block->subject;
    // Special classes for blocks.
    $vars['classes_array'][] = 'block-' . $block->module;
    $vars['classes_array'][] = 'region-' . $vars['block_zebra'];
    $vars['classes_array'][] = $vars['zebra'];
    $vars['classes_array'][] = 'region-count-' . $vars['block_id'];
    $vars['classes_array'][] = 'count-' . $vars['id'];
    // Create the block ID.
    $vars['block_html_id'] = 'block-' . $block->module . '-' . $block->delta;
    $vars['edit_links_array'] = array();
    if (user_access('administer blocks')) {
        include_once './' . drupal_get_path('theme', 'framework') . '/template.block-editing.inc';
        framework_preprocess_block_editing($vars, $hook);
        $vars['classes_array'][] = 'with-block-editing';
    }
    $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">' . implode(' ', $vars['edit_links_array']) . '</div>' : '';
}
Example #2
0
/**
 * Override or insert variables into the block templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("block" in this case.)
 */
function framework_preprocess_block(&$vars, $hook)
{
    $block = $vars['block'];
    // Special classes for blocks.
    $classes = array('block');
    $classes[] = 'block-' . $block->module;
    $classes[] = 'region-' . $vars['block_zebra'];
    $classes[] = $vars['zebra'];
    $classes[] = 'region-count-' . $vars['block_id'];
    $classes[] = 'count-' . $vars['id'];
    $vars['edit_links_array'] = array();
    $vars['edit_links'] = '';
    if (user_access('administer blocks')) {
        include_once './' . drupal_get_path('theme', 'framework') . '/template.block-editing.inc';
        framework_preprocess_block_editing($vars, $hook);
        $classes[] = 'with-block-editing';
    }
    // Render block classes.
    $vars['classes'] = implode(' ', $classes);
}