You are here

function space_customizer_block::submit in Spaces 6.2

Same name and namespace in other branches
  1. 6 spaces.module \space_customizer_block::submit()

Implementation of submit(). Iterate through and only record the aspects of each block that have been customized.

Overrides space_customizer::submit

File

./spaces.spaces.inc, line 264

Class

space_customizer_block
Customizer for feature blocks.

Code

function submit($space, $feature, $value) {
  $customizer = $space->customizer['block'];
  foreach ($value['contexts'] as $identifier => $context) {
    foreach ($context as $region => $blocks) {
      foreach ($blocks as $bid => $block) {
        foreach ($block as $k => $v) {

          // Clear out values that haven't changed from defaults
          if ($v === $value['defaults'][$identifier][$region][$bid][$k]) {
            unset($block[$k]);
          }
          else {
            if ($k == 'subject') {
              unset($block[$k]);
              $customizer['subject'][$bid] = $v;
            }
          }
        }
        if (!empty($block)) {
          $customizer[$identifier][$region][$bid] = $block;
        }
      }
    }
  }
  return $customizer;
}