/** * {@inheritdoc} */ public function before() { parent::before(); if (isset($this->request->cookies['data-table-per-page'])) { $this->object->rowsPerPage = intval($this->request->cookies['data-table-per-page']); } if (isset($this->request->cookies['data-table-density'])) { $this->object->density = $this->request->cookies['data-table-density']; } else { $this->object->density = 'medium'; } $tableSettings = new Form('tableSettings'); $tableSettings->addField('perPage', DataType::integer(DataType::UNSIGNED)); $tableSettings->__set('perPage', $this->object->rowsPerPage); $tableSettings->addField('density', DataType::enum(array('low', 'medium', 'high'))); $tableSettings->__set('density', $this->object->density); $this->viewData['tableSettings'] = $tableSettings; }
/** * Invoke the snippet using the settings object. * @return Jivoo\Routing\Response|string Response object or string. */ public function __invoke() { return $this->snippet->__invoke(array($this->object)); }