configModel->get('tweakdrag_column_gap_size', self::DEFAULT_GAP_SIZE); $columnGap = (int) $this->configModel->get('tweakdrag_column_gap', 1); $dragScroll = (int) $this->configModel->get('tweakdrag_drag_scroll', 1); $handleSize = (int) $this->configModel->get('tweakdrag_handle_size', self::DEFAULT_HANDLE_SIZE); $this->response->html($this->helper->layout->config('tweakDrag:config/show', array( 'title' => t('Settings').' > '.t('Tweak Drag'), 'values' => array( 'tweakdrag_column_gap_size' => $gapSize, 'tweakdrag_column_gap' => $columnGap, 'tweakdrag_drag_scroll' => $dragScroll, 'tweakdrag_handle_size' => $handleSize, ), 'errors' => array(), ))); } public function save() { $values = $this->request->getValues(); $gapSize = isset($values['tweakdrag_column_gap_size']) ? (int) $values['tweakdrag_column_gap_size'] : self::DEFAULT_GAP_SIZE; $gapSize = max(self::MIN_GAP_SIZE, min(self::MAX_GAP_SIZE, $gapSize)); $columnGap = isset($values['tweakdrag_column_gap']) ? 1 : 0; $dragScroll = isset($values['tweakdrag_drag_scroll']) ? 1 : 0; $handleSize = isset($values['tweakdrag_handle_size']) ? (int) $values['tweakdrag_handle_size'] : self::DEFAULT_HANDLE_SIZE; $handleSize = max(self::MIN_HANDLE_SIZE, min(self::MAX_HANDLE_SIZE, $handleSize)); if ($this->configModel->save(array( 'tweakdrag_column_gap_size' => $gapSize, 'tweakdrag_column_gap' => $columnGap, 'tweakdrag_drag_scroll' => $dragScroll, 'tweakdrag_handle_size' => $handleSize, ))) { $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' => 'TweakDrag'))); } }