1 | <?php |
||
17 | class Settings extends BackendController |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * Constructor |
||
22 | */ |
||
23 | public function __construct() |
||
24 | { |
||
25 | parent::__construct(); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Route page callback to display the module settings page |
||
30 | */ |
||
31 | public function editSettings() |
||
32 | { |
||
33 | $this->setTitleEditSettings(); |
||
34 | $this->setBreadcrumbEditSettings(); |
||
35 | |||
36 | $this->setData('settings', $this->getDevModuleSettings()); |
||
37 | |||
38 | $this->submitSettings(); |
||
39 | $this->outputEditSettings(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Returns an array of module settings |
||
44 | * @return array |
||
45 | */ |
||
46 | protected function getDevModuleSettings() |
||
47 | { |
||
48 | $settings = $this->getModuleSettings('dev'); |
||
49 | $settings['exception'] = $this->config('error_to_exception', false); |
||
50 | return $settings; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Set title on the module settings page |
||
55 | */ |
||
56 | protected function setTitleEditSettings() |
||
57 | { |
||
58 | $this->setTitle($this->text('Edit %name settings', array('%name' => $this->text('Dev')))); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Set breadcrumbs on the module settings page |
||
63 | */ |
||
64 | protected function setBreadcrumbEditSettings() |
||
65 | { |
||
66 | $breadcrumbs = array(); |
||
67 | |||
68 | $breadcrumbs[] = array( |
||
69 | 'text' => $this->text('Dashboard'), |
||
70 | 'url' => $this->url('admin') |
||
71 | ); |
||
72 | |||
73 | $breadcrumbs[] = array( |
||
74 | 'text' => $this->text('Modules'), |
||
75 | 'url' => $this->url('admin/module/list') |
||
76 | ); |
||
77 | |||
78 | $this->setBreadcrumbs($breadcrumbs); |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Saves the submitted settings |
||
83 | */ |
||
84 | protected function submitSettings() |
||
90 | |||
91 | /** |
||
92 | * Validate submitted module settings |
||
93 | */ |
||
94 | protected function validateSettings() |
||
99 | |||
100 | /** |
||
101 | * Update module settings |
||
102 | */ |
||
103 | protected function updateSettings() |
||
104 | { |
||
114 | |||
115 | /** |
||
116 | * Render and output the module settings page |
||
117 | */ |
||
118 | protected function outputEditSettings() |
||
122 | |||
123 | } |
||
124 |