public function createInZone(DmZone $zone, $moduleAction, $values = array()) { list($module, $action) = explode('/', $moduleAction); $widget = $this->create(array('dm_zone_id' => $zone->get('id'), 'module' => $module, 'action' => $action)); $widget->setValues($values); return $widget; }
public function paste(DmZone $zone) { if (!($widget = $this->getWidget())) { return; } if ('cut' == $this->getMethod()) { $widget->set('dm_zone_id', $zone->get('id')); // cutted then pasted widget becomes copied widget $this->save('widget', array('method' => 'copy', 'id' => $widget->id)); } else { $widget->get('Translation'); $widget = $widget->copy(true); $widget->set('dm_zone_id', $zone->get('id')); } $widget->save(); return $widget; }