/**
  * @param int            $id
  * @param null|WidgetMap $parent
  */
 protected function newWidgetMap($id, $parent, $position, View $view, Widget $widget)
 {
     $widgetMap = new WidgetMap();
     $widgetMap->setId($id);
     if ($parent) {
         $widgetMap->setParent($parent);
         $parent->addChild($widgetMap);
     }
     $widgetMap->setPosition($position);
     $widgetMap->setWidget($widget);
     $widgetMap->setSlot('content');
     $view->addWidgetMap($widgetMap);
     return $widgetMap;
 }
Example #2
0
 /**
  * the widget is owned by another view (a parent)
  * so we add a new widget map that indicates we delete this widget.
  *
  * @param View      $view
  * @param WidgetMap $originalWidgetMap
  * @param Widget    $widgetCopy
  *
  * @throws \Exception
  */
 public function overwrite(View $view, WidgetMap $originalWidgetMap, Widget $widgetCopy)
 {
     $widgetMap = new WidgetMap();
     $widgetMap->setAction(WidgetMap::ACTION_OVERWRITE);
     $widgetMap->setReplaced($originalWidgetMap);
     $widgetCopy->setWidgetMap($widgetMap);
     $widgetMap->setSlot($originalWidgetMap->getSlot());
     $widgetMap->setPosition($originalWidgetMap->getPosition());
     $widgetMap->setParent($originalWidgetMap->getParent());
     $view->addWidgetMap($widgetMap);
 }