public function set_values(array $data) { parent::set_values($data); $profile_id_ctx = Arr::get($data, 'profile_id_ctx'); $this->profile_id_ctx = empty($profile_id_ctx) ? $this->profile_id_ctx : $profile_id_ctx; return $this; }
public function set_values(array $data) { if (empty($data['exclude'])) { $this->exclude = array(); } return parent::set_values($data); }
public function set_values(array $data) { if (empty($data['exclude'])) { $this->exclude = array(); } parent::set_values($data); $this->match_all_paths = (bool) Arr::get($data, 'match_all_paths'); $this->include_hidden = (bool) Arr::get($data, 'include_hidden'); return $this; }
/** * * @param array $data */ public function set_values(array $data) { $this->doc_fields = $this->doc_fetched_widgets = array(); parent::set_values($data); $this->docs_uri = Arr::get($data, 'docs_uri', $this->docs_uri); $this->doc_id_field = Arr::get($data, 'doc_id_field', $this->doc_id_field); $doc_id_ctx = Arr::get($data, 'doc_id_ctx'); $this->doc_id_ctx = empty($doc_id_ctx) ? $this->doc_id_ctx : $doc_id_ctx; $this->throw_404 = (bool) Arr::get($data, 'throw_404'); $this->crumbs = (bool) Arr::get($data, 'crumbs'); $this->seo_information = (bool) Arr::get($data, 'seo_information'); return $this; }
/** * Метод используется для сохранения настроек виджета. * Вызывается в момент сохранения виджета. * * Допустим * $data = array( * 'param' => '....', * 'param1' => '123' * ..... * ); * * Если для ключа массива имеется метод set_{$key}, то будет вызван метод, * в который будет передано значение, например * для 'param1' => '123' будет произведен поиск метода set_param1 и в случае * успеха выполнен $this->param1 = $this->set_param1(123); * * Если метод не найден, то будет произведено обычное присвоение * $this->param = ....; * * @param array $data */ public function set_values(array $data) { $data['param'] = (bool) Arr::get($data, 'param'); return parent::set_values($data); }
protected function _edit(Model_Widget_Decorator $widget) { $data = $this->request->post(); try { if (!ACL::check('widget.roles') and !empty($data['roles'])) { $data['roles'] = array(); } if (ACL::check('widgets.cache')) { $widget->set_cache_settings($data); } $widget->set_values($data); Widget_Manager::update($widget); Observer::notify('widget_after_edit', $widget->id); } catch (Validation_Exception $e) { Flash::set('post_data', $data); Messages::errors($e->errors('validation')); $this->go_back(); } // save and quit or save and continue editing? if ($this->request->post('commit') !== NULL) { $this->go(); } else { $this->go(array('controller' => 'widgets', 'action' => 'edit', 'id' => $widget->id)); } }