Ejemplo n.º 1
0
 protected function _delete_route($route, $style_id)
 {
     $entity = $this->route_mapper->load(array('route' => $route, 'style' => $style_id));
     if ($entity) {
         $this->route_mapper->delete($entity);
     }
 }
Ejemplo n.º 2
0
 public function execute($style_id)
 {
     $this->route_mapper = $this->mapper_factory->create('blocks', 'routes');
     $route = array('route' => $this->request->variable('route', ''), 'style' => $style_id);
     $route_prefs = array('hide_blocks' => $this->request->variable('hide_blocks', false), 'ex_positions' => array_filter($this->request->variable('ex_positions', array(0 => ''))));
     // user has made choices that differ from defaults
     if ($this->_route_is_customized($route_prefs)) {
         // create/update route regardless of whether it has blocks or not
         $entity = $this->_force_get_route($route);
         $this->_update_route($entity, $route_prefs);
     } else {
         if ($entity = $this->route_mapper->load($route)) {
             $this->_update_or_remove($entity, $route_prefs);
         }
     }
     return array('message' => $this->user->lang('ROUTE_UPDATED'));
 }