You are here

function menu_block_preprocess_block in Menu Block 8

Implements hook_preprocess_hook() for "block".

Set the block label with the #menu_block_configuration label if it exists.

See also

template_preprocess_block()

File

./menu_block.module, line 116
Provides configurable blocks of menu links.

Code

function menu_block_preprocess_block(&$variables) {
  if (isset($variables['content']['#menu_block_configuration']['label'])) {
    $config_label = $variables['content']['#menu_block_configuration']['label'];

    // Set the 'label' template variable to an empty string if the block is
    // configured not to display a label.
    $variables['label'] = empty($variables['configuration']['label_display']) ? '' : $config_label;

    // However, we always set the configuration label (regardless of the
    // 'label_display' setting) so the label can be included in the markup as
    // hidden text for assistive technologies (for templates that handle this).
    $variables['configuration']['label'] = $config_label;
  }
}