You are here

function defaultcontent_context_block_info_alter in Default Content 7

Same name and namespace in other branches
  1. 7.2 defaultcontent.module \defaultcontent_context_block_info_alter()

Implements hook_context_block_info_alter().

we change all nodeblock to use a machine name when load into context

File

./defaultcontent.module, line 461
Module file for the Default content module which allow export and import of default content in a Drupal site.

Code

function defaultcontent_context_block_info_alter(&$blocks) {
  foreach ($blocks as $key => $block) {
    if ($block->module == 'nodeblock' && is_numeric($block->delta) && ($machine_name = defaultcontent_get_default($block->delta))) {
      $block->delta = $machine_name;
      $block->bid = "nodeblock-{$machine_name}";
      $blocks["nodeblock-{$machine_name}"] = $block;
      unset($blocks[$key]);
    }
  }
}