Beispiel #1
0
 /**
  * Add widget.
  *
  * @param Widget $widgetMap
  */
 public function addWidgetMap(WidgetMap $widgetMap)
 {
     if (!$widgetMap->getView()) {
         $widgetMap->setView($this);
     }
     $this->widgetMaps[] = $widgetMap;
 }
Beispiel #2
0
 /**
  * Move given WidgetMap as a child of given parent at given position and slot.
  *
  * @param View      $view
  * @param WidgetMap $widgetMap
  * @param bool      $parent
  * @param bool      $position
  * @param bool      $slot
  *
  * @return WidgetMap
  */
 protected function moveWidgetMap(View $view, WidgetMap $widgetMap, $parent = false, $position = false, $slot = false)
 {
     if ($widgetMap->getView() !== $view) {
         $widgetMap = $this->cloneWidgetMap($widgetMap, $view);
     }
     if ($parent !== false) {
         if ($oldParent = $widgetMap->getParent()) {
             $oldParent->removeChild($widgetMap);
         }
         $widgetMap->setParent($parent);
         if ($parent) {
             $parent->addChild($widgetMap);
         }
     }
     if ($position !== false) {
         $widgetMap->setPosition($position);
     }
     if ($slot !== false) {
         $widgetMap->setSlot($slot);
     }
     return $widgetMap;
 }