/**
  * Creating a space override.
  *
  * type: POST
  * values: {
  *  vsite: 2,
  *  delta: 1419342352,
  *  widget: os_taxonomy_fbt,
  *  options: [
  *    description: "Terms"
  *  ]
  * }
  */
 public function createSpace()
 {
     // Check group access.
     $this->checkGroupAccess();
     // Validate the object from the request.
     $this->validate();
     // Creating a new widget.
     $options = array('delta' => time()) + $this->object->options;
     // Create the box the current vsite.
     $box = boxes_box::factory($this->object->widget, $options);
     $this->space->controllers->boxes->set($box->delta, $box);
     return (array) $box;
 }
Example #2
0
 /**
  * Hide the box. If the box is not exported, the function will delete the box.
  *
  *  @param $nid
  *    The node id of the site.
  *  @param $plugin
  *    The box plugin name from the mapped boxes.
  *  @param $delta
  *    The delta of the box.
  *  @param $page
  *    The machine name page from the mapped pages.
  *
  *  @see static::SetBoxInRegion().
  */
 public static function hideBox($nid, $plugin, $delta, $page)
 {
     // Hide the box.
     ctools_include('layout', 'os');
     $contexts = array($page, 'os_public');
     $blocks = os_layout_get_multiple($contexts, FALSE, TRUE);
     if (empty($blocks[$plugin])) {
         $blocks['boxes-' . $delta]['region'] = FALSE;
         // Delete the box.
         if ($box = boxes_box::factory($plugin, array())) {
             $box->delete();
         }
     } else {
         $blocks[$plugin]['region'] = FALSE;
     }
     $vsite = spaces_load('og', $nid);
     $vsite->controllers->context->set($page . ":reaction:block", array('blocks' => $blocks));
 }