You are here

function boxes_boxes_box_load_alter in Boxes 7

Implements hook_boxes_box_load_alter().

Provides spaces integration for per-space overrides of a given box.

File

./boxes.module, line 764
Core functionality for boxes module.

Code

function boxes_boxes_box_load_alter(&$box, $delta) {
  if (!$delta) {
    $delta = $box->delta;
  }
  if (module_exists('spaces') && ($space = spaces_get_space())) {
    if ($space_box = $space->controllers->boxes
      ->get($delta)) {

      // Some older overrides may be stored as an array, check for these and
      // convert them to objects.
      if (is_array($space_box)) {
        $space_box = (object) $space_box;
      }
      $box = boxes_factory($space_box->plugin_key, $space_box);
      $box->new = FALSE;
    }
  }
}