You are here

function space_customizer_block::customize in Spaces 6

Same name and namespace in other branches
  1. 6.2 spaces.spaces.inc \space_customizer_block::customize()

Implementation of customize().

Overrides space_customizer::customize

1 call to space_customizer_block::customize()
spaces_context_active_contexts_alter in ./spaces.module
Implementation of hook_context_active_contexts_alter().

File

./spaces.module, line 853

Class

space_customizer_block
Customizer for feature blocks.

Code

function customize($space, $feature, &$block = NULL) {

  // Unset disabled blocks and change weights based on customizer settings. See spaces_context_active_contexts_alter.
  if (!empty($space->customizer[$feature]['block'])) {
    $customizer = $space->customizer[$feature]['block'];
    foreach ($block as $key => $b) {

      // @TODO: remove this once context is less confused about itself.
      $b = (array) $b;
      $block[$key] = (array) $block[$key];
      $bid = "{$b['module']}-{$b['delta']}";

      // If the block is not enabled, yank it out of the blocks array
      if (!empty($customizer[$b['region']][$bid])) {
        if (isset($customizer[$b['region']][$bid]['status']) && $customizer[$b['region']][$bid]['status'] === 0) {
          unset($block[$key]);
        }
        if (isset($customizer[$b['region']][$bid]['weight'])) {
          $block[$key]['weight'] = $customizer[$b['region']][$bid]['weight'];
        }
      }
    }
  }
}