Example #1
0
 /**
  * Find a widgetMap by widgetId and view.
  *
  * @param int  $widgetId
  * @param View $view
  *
  * @return WidgetMap
  **/
 public function removeWidgetMapByWidgetIdAndView($widgetId, View $view)
 {
     foreach ($view->getSlots() as $_slot) {
         foreach ($_slot->getWidgetMaps() as $_widgetMap) {
             if ($_widgetMap->getWidgetId() == $widgetId) {
                 $_slot->removeWidgetMap($_widgetMap);
                 //update the widget map
                 $view->updateWidgetMapBySlots();
                 return ['success' => true];
             }
         }
     }
     return ['success' => false, 'message' => 'The widget isn\'t present in widgetMap...'];
 }