diff --git a/Controller/ConfigController.php b/Controller/ConfigController.php new file mode 100644 index 0000000..f9ca180 --- /dev/null +++ b/Controller/ConfigController.php @@ -0,0 +1,45 @@ +configModel->get('shrink_vertically_offset', self::DEFAULT_OFFSET); + + $this->response->html($this->helper->layout->config('shrinkVertically:config/show', array( + 'title' => t('Settings').' > '.t('Shrink Vertically'), + 'values' => array( + 'shrink_vertically_offset' => $offset, + ), + 'errors' => array(), + ))); + } + + public function save() + { + $values = $this->request->getValues(); + + $offset = isset($values['shrink_vertically_offset']) ? (int) $values['shrink_vertically_offset'] : self::DEFAULT_OFFSET; + $offset = max(self::MIN_OFFSET, min(self::MAX_OFFSET, $offset)); + + if ($this->configModel->save(array('shrink_vertically_offset' => $offset))) { + $this->flash->success(t('Settings saved successfully.')); + } else { + $this->flash->failure(t('Unable to save your settings.')); + } + + $this->response->redirect($this->helper->url->to('ConfigController', 'show', array('plugin' => 'ShrinkVertically'))); + } +} diff --git a/Template/config/show.php b/Template/config/show.php new file mode 100644 index 0000000..7d6c982 --- /dev/null +++ b/Template/config/show.php @@ -0,0 +1,19 @@ +