Total Complexity | 157 |
Total Lines | 993 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
Complex classes like contentBlueprintsSections often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use contentBlueprintsSections, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
11 | class contentBlueprintsSections extends AdministrationPage |
||
12 | { |
||
13 | public $_errors = array(); |
||
14 | |||
15 | public function build(array $context = array()) |
||
26 | } |
||
27 | |||
28 | public function __viewIndex() |
||
29 | { |
||
30 | $this->setPageType('table'); |
||
31 | $this->setTitle(__('%1$s – %2$s', array(__('Sections'), __('Symphony')))); |
||
32 | $this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL().'new/', __('Create a section'), 'create button', null, array('accesskey' => 'c'))); |
||
33 | |||
34 | $sections = SectionManager::fetch(null, 'ASC', 'sortorder'); |
||
35 | |||
36 | $aTableHead = array( |
||
37 | array(__('Name'), 'col'), |
||
38 | array(__('Entries'), 'col'), |
||
39 | array(__('Navigation Group'), 'col') |
||
40 | ); |
||
41 | |||
42 | $aTableBody = array(); |
||
43 | |||
44 | if (!is_array($sections) || empty($sections)) { |
||
45 | $aTableBody = array( |
||
46 | Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', null, count($aTableHead))), 'odd') |
||
47 | ); |
||
48 | } else { |
||
49 | foreach ($sections as $s) { |
||
50 | $entry_count = EntryManager::fetchCount($s->get('id')); |
||
51 | |||
52 | // Setup each cell |
||
53 | $td1 = Widget::TableData(Widget::Anchor(General::sanitize($s->get('name')), Administration::instance()->getCurrentPageURL() . 'edit/' . $s->get('id') .'/', null, 'content')); |
||
54 | $td1->appendChild(Widget::Label(__('Select Section %s', array(General::sanitize($s->get('name')))), null, 'accessible', null, array( |
||
55 | 'for' => 'section-' . $s->get('id') |
||
56 | ))); |
||
57 | $td1->appendChild(Widget::Input('items['.$s->get('id').']', $s->get('modification_date'), 'checkbox', array( |
||
58 | 'id' => 'section-' . $s->get('id') |
||
59 | ))); |
||
60 | |||
61 | $td2 = Widget::TableData(Widget::Anchor((string)$entry_count, SYMPHONY_URL . '/publish/' . $s->get('handle') . '/')); |
||
62 | $td3 = Widget::TableData(General::sanitize($s->get('navigation_group'))); |
||
63 | |||
64 | // Create row |
||
65 | $tr = Widget::TableRow(array($td1, $td2, $td3)); |
||
66 | |||
67 | if ($s->get('hidden') === 'yes') { |
||
68 | $tr->setAttribute('class', 'inactive'); |
||
69 | } |
||
70 | |||
71 | $aTableBody[] = $tr; |
||
72 | } |
||
73 | } |
||
74 | |||
75 | $table = Widget::Table( |
||
76 | Widget::TableHead($aTableHead), |
||
77 | null, |
||
78 | Widget::TableBody($aTableBody), |
||
79 | 'orderable selectable', |
||
80 | null, |
||
81 | array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive') |
||
82 | ); |
||
83 | |||
84 | $this->Form->appendChild($table); |
||
85 | |||
86 | $version = new XMLElement('p', 'Symphony ' . Symphony::Configuration()->get('version', 'symphony'), array( |
||
87 | 'id' => 'version' |
||
88 | )); |
||
89 | |||
90 | $this->Form->appendChild($version); |
||
91 | |||
92 | $tableActions = new XMLElement('div'); |
||
93 | $tableActions->setAttribute('class', 'actions'); |
||
94 | |||
95 | $options = array( |
||
96 | array(null, false, __('With Selected...')), |
||
97 | array('delete', false, __('Delete'), 'confirm', null, array( |
||
98 | 'data-message' => __('Are you sure you want to delete the selected sections?') |
||
99 | )), |
||
100 | array('delete-entries', false, __('Delete Entries'), 'confirm', null, array( |
||
101 | 'data-message' => __('Are you sure you want to delete all entries in the selected sections?') |
||
102 | )) |
||
103 | ); |
||
104 | |||
105 | if (is_array($sections) && !empty($sections)) { |
||
106 | $index = 3; |
||
107 | $options[$index] = array('label' => __('Set navigation group'), 'options' => array()); |
||
108 | |||
109 | $groups = array(); |
||
110 | |||
111 | foreach ($sections as $s) { |
||
112 | if (in_array($s->get('navigation_group'), $groups)) { |
||
113 | continue; |
||
114 | } |
||
115 | |||
116 | $groups[] = $s->get('navigation_group'); |
||
117 | |||
118 | $value = 'set-navigation-group-' . urlencode($s->get('navigation_group')); |
||
119 | $options[$index]['options'][] = array($value, false, General::sanitize($s->get('navigation_group'))); |
||
120 | } |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * Allows an extension to modify the existing options for this page's |
||
125 | * With Selected menu. If the `$options` parameter is an empty array, |
||
126 | * the 'With Selected' menu will not be rendered. |
||
127 | * |
||
128 | * @delegate AddCustomActions |
||
129 | * @since Symphony 2.3.2 |
||
130 | * @param string $context |
||
131 | * '/blueprints/sections/' |
||
132 | * @param array $options |
||
133 | * An array of arrays, where each child array represents an option |
||
134 | * in the With Selected menu. Options should follow the same format |
||
135 | * expected by `Widget::__SelectBuildOption`. Passed by reference. |
||
136 | */ |
||
137 | Symphony::ExtensionManager()->notifyMembers('AddCustomActions', '/blueprints/sections/', array( |
||
138 | 'options' => &$options |
||
139 | )); |
||
140 | |||
141 | if (!empty($options)) { |
||
142 | $tableActions->appendChild(Widget::Apply($options)); |
||
143 | $this->Form->appendChild($tableActions); |
||
144 | } |
||
145 | } |
||
146 | |||
147 | public function __viewNew() |
||
148 | { |
||
149 | $this->setPageType('form'); |
||
150 | $this->setTitle(__('%1$s – %2$s', array(__('Sections'), __('Symphony')))); |
||
151 | $this->appendSubheading(__('Untitled')); |
||
152 | $this->insertBreadcrumbs(array( |
||
153 | Widget::Anchor(__('Sections'), SYMPHONY_URL . '/blueprints/sections/'), |
||
154 | )); |
||
155 | |||
156 | $types = array(); |
||
157 | |||
158 | $fields = (isset($_POST['fields']) && is_array($_POST['fields'])) ? $_POST['fields'] : array(); |
||
159 | $meta = (isset($_POST['meta']) && is_array($_POST['meta'])) ? $_POST['meta'] : array('name'=>null); |
||
160 | |||
161 | $formHasErrors = (is_array($this->_errors) && !empty($this->_errors)); |
||
162 | |||
163 | if ($formHasErrors) { |
||
164 | $this->pageAlert( |
||
165 | __('An error occurred while processing this form. See below for details.'), |
||
166 | Alert::ERROR |
||
167 | ); |
||
168 | } |
||
169 | |||
170 | $showEmptyTemplate = (is_array($fields) && !empty($fields) ? false : true); |
||
171 | |||
172 | if (!$showEmptyTemplate) { |
||
173 | ksort($fields); |
||
174 | } |
||
175 | |||
176 | // Set navigation group, if not already set |
||
177 | if (!isset($meta['navigation_group'])) { |
||
178 | $meta['navigation_group'] = (isset($this->_navigation[0]['name']) ? $this->_navigation[0]['name'] : __('Content')); |
||
179 | } |
||
180 | |||
181 | $fieldset = new XMLElement('fieldset'); |
||
182 | $fieldset->setAttribute('class', 'settings'); |
||
183 | $fieldset->appendChild(new XMLElement('legend', __('Essentials'))); |
||
184 | |||
185 | $namediv = new XMLElement('div', null, array('class' => 'column')); |
||
186 | |||
187 | $label = Widget::Label(__('Name')); |
||
188 | $label->appendChild(Widget::Input('meta[name]', (isset($meta['name']) ? General::sanitize($meta['name']) : null))); |
||
189 | |||
190 | if (isset($this->_errors['name'])) { |
||
191 | $namediv->appendChild(Widget::Error($label, $this->_errors['name'])); |
||
192 | } else { |
||
193 | $namediv->appendChild($label); |
||
194 | } |
||
195 | |||
196 | $fieldset->appendChild($namediv); |
||
197 | |||
198 | $div = new XMLElement('div', null, array('class' => 'two columns')); |
||
199 | |||
200 | $handlediv = new XMLElement('div', null, array('class' => 'column')); |
||
201 | |||
202 | $label = Widget::Label(__('Handle')); |
||
203 | $label->appendChild(Widget::Input('meta[handle]', (isset($meta['handle']) ? General::sanitize($meta['handle']) : null))); |
||
204 | |||
205 | if (isset($this->_errors['handle'])) { |
||
206 | $handlediv->appendChild(Widget::Error($label, $this->_errors['handle'])); |
||
207 | } else { |
||
208 | $handlediv->appendChild($label); |
||
209 | } |
||
210 | |||
211 | $div->appendChild($handlediv); |
||
212 | |||
213 | $navgroupdiv = new XMLElement('div', null, array('class' => 'column')); |
||
214 | |||
215 | $sections = SectionManager::fetch(null, 'ASC', 'sortorder'); |
||
216 | $label = Widget::Label(__('Navigation Group')); |
||
217 | $label->appendChild(Widget::Input('meta[navigation_group]', (isset($meta['navigation_group']) ? General::sanitize($meta['navigation_group']) : null))); |
||
218 | |||
219 | if (isset($this->_errors['navigation_group'])) { |
||
220 | $navgroupdiv->appendChild(Widget::Error($label, $this->_errors['navigation_group'])); |
||
221 | } else { |
||
222 | $navgroupdiv->appendChild($label); |
||
223 | } |
||
224 | |||
225 | if (is_array($sections) && !empty($sections)) { |
||
226 | $ul = new XMLElement('ul', null, array('class' => 'tags singular', 'data-interactive' => 'data-interactive')); |
||
227 | $groups = array(); |
||
228 | |||
229 | foreach ($sections as $s) { |
||
230 | if (in_array($s->get('navigation_group'), $groups)) { |
||
231 | continue; |
||
232 | } |
||
233 | |||
234 | $ul->appendChild(new XMLElement('li', General::sanitize($s->get('navigation_group')))); |
||
235 | $groups[] = $s->get('navigation_group'); |
||
236 | } |
||
237 | |||
238 | $navgroupdiv->appendChild($ul); |
||
239 | } |
||
240 | |||
241 | $div->appendChild($navgroupdiv); |
||
242 | $fieldset->appendChild($div); |
||
243 | $this->Form->appendChild($fieldset); |
||
244 | |||
245 | $this->addSectionOptions($meta); |
||
246 | |||
247 | $fieldset = new XMLElement('fieldset'); |
||
248 | $fieldset->setAttribute('class', 'settings'); |
||
249 | |||
250 | $legend = new XMLElement('legend', __('Fields')); |
||
251 | $legend->setAttribute('id', 'fields-legend'); |
||
252 | $fieldset->appendChild($legend); |
||
253 | |||
254 | $div = new XMLElement('div', null, array('class' => 'frame', 'id' => 'fields-duplicator')); |
||
255 | |||
256 | $ol = new XMLElement('ol'); |
||
257 | $ol->setAttribute('data-add', __('Add field')); |
||
258 | $ol->setAttribute('data-remove', __('Remove field')); |
||
259 | |||
260 | if (!$showEmptyTemplate) { |
||
261 | foreach ($fields as $position => $data) { |
||
262 | if ($input = FieldManager::create($data['type'])) { |
||
263 | $input->setArray($data); |
||
264 | |||
265 | $wrapper = new XMLElement('li'); |
||
266 | |||
267 | $input->set('sortorder', $position); |
||
268 | $input->displaySettingsPanel($wrapper, (isset($this->_errors[$position]) ? $this->_errors[$position] : null)); |
||
269 | $ol->appendChild($wrapper); |
||
270 | } |
||
271 | } |
||
272 | } |
||
273 | |||
274 | foreach (FieldManager::listAll() as $type) { |
||
275 | if ($type = FieldManager::create($type)) { |
||
276 | $types[] = $type; |
||
277 | } |
||
278 | } |
||
279 | |||
280 | uasort($types, function($a, $b) { |
||
281 | return strnatcasecmp($a->_name, $b->_name); |
||
282 | }); |
||
283 | |||
284 | foreach ($types as $type) { |
||
285 | $defaults = array(); |
||
286 | |||
287 | $type->findDefaults($defaults); |
||
288 | $type->setArray($defaults); |
||
289 | |||
290 | $wrapper = new XMLElement('li'); |
||
291 | $wrapper->setAttribute('class', 'template field-' . $type->handle() . ($type->mustBeUnique() ? ' unique' : null)); |
||
292 | $wrapper->setAttribute('data-type', $type->handle()); |
||
293 | |||
294 | $type->set('sortorder', '-1'); |
||
295 | $type->displaySettingsPanel($wrapper); |
||
296 | |||
297 | $ol->appendChild($wrapper); |
||
298 | } |
||
299 | |||
300 | $div->appendChild($ol); |
||
301 | $fieldset->appendChild($div); |
||
302 | |||
303 | $this->Form->appendChild($fieldset); |
||
304 | |||
305 | $div = new XMLElement('div'); |
||
306 | $div->setAttribute('class', 'actions'); |
||
307 | $div->appendChild(Widget::Input('action[save]', __('Create Section'), 'submit', array('accesskey' => 's'))); |
||
308 | |||
309 | $this->Form->appendChild($div); |
||
310 | } |
||
311 | |||
312 | public function __viewEdit() |
||
313 | { |
||
314 | $section_id = $this->_context[1]; |
||
315 | |||
316 | if (!$section = SectionManager::fetch($section_id)) { |
||
317 | Administration::instance()->throwCustomError( |
||
318 | __('The Section, %s, could not be found.', array($section_id)), |
||
319 | __('Unknown Section'), |
||
320 | Page::HTTP_STATUS_NOT_FOUND |
||
321 | ); |
||
322 | } |
||
323 | |||
324 | $meta = $section->get(); |
||
325 | $section_id = $meta['id']; |
||
326 | $types = array(); |
||
327 | $canonical_link = '/blueprints/sections/edit/' . $section_id . '/'; |
||
328 | |||
329 | $formHasErrors = (is_array($this->_errors) && !empty($this->_errors)); |
||
330 | |||
331 | if ($formHasErrors) { |
||
332 | $this->pageAlert( |
||
333 | __('An error occurred while processing this form. See below for details.'), |
||
334 | Alert::ERROR |
||
335 | ); |
||
336 | |||
337 | // These alerts are only valid if the form doesn't have errors |
||
338 | } elseif (isset($this->_context[2])) { |
||
339 | $time = Widget::Time(); |
||
340 | |||
341 | switch ($this->_context[2]) { |
||
342 | case 'saved': |
||
343 | $message = __('Section updated at %s.', array($time->generate())); |
||
344 | break; |
||
345 | case 'created': |
||
346 | $message = __('Section created at %s.', array($time->generate())); |
||
347 | } |
||
348 | |||
349 | $this->pageAlert( |
||
350 | $message |
||
351 | . ' <a href="' . SYMPHONY_URL . '/blueprints/sections/new/" accesskey="c">' |
||
352 | . __('Create another?') |
||
353 | . '</a> <a href="' . SYMPHONY_URL . '/blueprints/sections/" accesskey="a">' |
||
354 | . __('View all Sections') |
||
355 | . '</a>', |
||
356 | Alert::SUCCESS |
||
357 | ); |
||
358 | } |
||
359 | |||
360 | if (isset($_POST['fields'])) { |
||
361 | $fields = array(); |
||
362 | if (is_array($_POST['fields']) && !empty($_POST['fields'])) { |
||
363 | foreach ($_POST['fields'] as $position => $data) { |
||
364 | if ($fields[$position] = FieldManager::create($data['type'])) { |
||
365 | $fields[$position]->setArray($data); |
||
366 | $fields[$position]->set('sortorder', $position); |
||
367 | } |
||
368 | } |
||
369 | } |
||
370 | $timestamp = isset($_POST['action']['timestamp']) |
||
371 | ? $_POST['action']['timestamp'] |
||
372 | : $section->get('modification_date'); |
||
373 | } else { |
||
374 | $fields = FieldManager::fetch(null, $section_id); |
||
375 | $fields = array_values($fields); |
||
376 | $timestamp = $section->get('modification_date'); |
||
377 | } |
||
378 | |||
379 | if (isset($_POST['meta'])) { |
||
380 | $meta = $_POST['meta']; |
||
381 | if ($meta['name'] == '') { |
||
382 | $meta['name'] = $section->get('name'); |
||
383 | } |
||
384 | } |
||
385 | |||
386 | $this->setPageType('form'); |
||
387 | $this->setTitle(__('%1$s – %2$s – %3$s', array(General::sanitize($meta['name']), __('Sections'), __('Symphony')))); |
||
388 | $this->addElementToHead(new XMLElement('link', null, array( |
||
389 | 'rel' => 'canonical', |
||
390 | 'href' => SYMPHONY_URL . $canonical_link, |
||
391 | ))); |
||
392 | $this->appendSubheading(General::sanitize($meta['name']), |
||
393 | Widget::Anchor(__('View Entries'), SYMPHONY_URL . '/publish/' . $section->get('handle') . '/', __('View Section Entries'), 'button') |
||
394 | ); |
||
395 | $this->insertBreadcrumbs(array( |
||
396 | Widget::Anchor(__('Sections'), SYMPHONY_URL . '/blueprints/sections/'), |
||
397 | )); |
||
398 | |||
399 | $fieldset = new XMLElement('fieldset'); |
||
400 | $fieldset->setAttribute('class', 'settings'); |
||
401 | $fieldset->appendChild(new XMLElement('legend', __('Essentials'))); |
||
402 | |||
403 | $namediv = new XMLElement('div', null, array('class' => 'column')); |
||
404 | |||
405 | $label = Widget::Label(__('Name')); |
||
406 | $label->appendChild(Widget::Input('meta[name]', (isset($meta['name']) ? General::sanitize($meta['name']) : null))); |
||
407 | |||
408 | if (isset($this->_errors['name'])) { |
||
409 | $namediv->appendChild(Widget::Error($label, $this->_errors['name'])); |
||
410 | } else { |
||
411 | $namediv->appendChild($label); |
||
412 | } |
||
413 | |||
414 | $fieldset->appendChild($namediv); |
||
415 | |||
416 | $div = new XMLElement('div', null, array('class' => 'two columns')); |
||
417 | |||
418 | $handlediv = new XMLElement('div', null, array('class' => 'column')); |
||
419 | |||
420 | $label = Widget::Label(__('Handle')); |
||
421 | $label->appendChild(Widget::Input('meta[handle]', (isset($meta['handle']) ? General::sanitize($meta['handle']) : null))); |
||
422 | |||
423 | if (isset($this->_errors['handle'])) { |
||
424 | $handlediv->appendChild(Widget::Error($label, $this->_errors['handle'])); |
||
425 | } else { |
||
426 | $handlediv->appendChild($label); |
||
427 | } |
||
428 | |||
429 | $div->appendChild($handlediv); |
||
430 | |||
431 | $navgroupdiv = new XMLElement('div', null, array('class' => 'column')); |
||
432 | |||
433 | $sections = SectionManager::fetch(null, 'ASC', 'sortorder'); |
||
434 | $label = Widget::Label(__('Navigation Group')); |
||
435 | $label->appendChild(Widget::Input('meta[navigation_group]', General::sanitize($meta['navigation_group']))); |
||
436 | |||
437 | if (isset($this->_errors['navigation_group'])) { |
||
438 | $navgroupdiv->appendChild(Widget::Error($label, $this->_errors['navigation_group'])); |
||
439 | } else { |
||
440 | $navgroupdiv->appendChild($label); |
||
441 | } |
||
442 | |||
443 | if (is_array($sections) && !empty($sections)) { |
||
444 | $ul = new XMLElement('ul', null, array('class' => 'tags singular', 'data-interactive' => 'data-interactive')); |
||
445 | $groups = array(); |
||
446 | |||
447 | foreach ($sections as $s) { |
||
448 | if (in_array($s->get('navigation_group'), $groups)) { |
||
449 | continue; |
||
450 | } |
||
451 | |||
452 | $ul->appendChild(new XMLElement('li', General::sanitize($s->get('navigation_group')))); |
||
453 | $groups[] = $s->get('navigation_group'); |
||
454 | } |
||
455 | |||
456 | $navgroupdiv->appendChild($ul); |
||
457 | } |
||
458 | |||
459 | $div->appendChild($navgroupdiv); |
||
460 | $fieldset->appendChild($div); |
||
461 | $this->Form->appendChild($fieldset); |
||
462 | |||
463 | $this->addSectionOptions($meta); |
||
464 | |||
465 | $fieldset = new XMLElement('fieldset'); |
||
466 | $fieldset->setAttribute('class', 'settings'); |
||
467 | |||
468 | $legend = new XMLElement('legend', __('Fields')); |
||
469 | $legend->setAttribute('id', 'fields-legend'); |
||
470 | $fieldset->appendChild($legend); |
||
471 | |||
472 | $div = new XMLElement('div', null, array('class' => 'frame', 'id' => 'fields-duplicator')); |
||
473 | |||
474 | $ol = new XMLElement('ol'); |
||
475 | $ol->setAttribute('data-add', __('Add field')); |
||
476 | $ol->setAttribute('data-remove', __('Remove field')); |
||
477 | |||
478 | if (is_array($fields) && !empty($fields)) { |
||
479 | foreach ($fields as $position => $field) { |
||
480 | $wrapper = new XMLElement('li', null, array('class' => 'field-' . $field->handle() . ($field->mustBeUnique() ? ' unique' : null))); |
||
481 | $wrapper->setAttribute('data-type', $field->handle()); |
||
482 | |||
483 | $field->set('sortorder', $position); |
||
484 | $field->displaySettingsPanel($wrapper, (isset($this->_errors[$position]) ? $this->_errors[$position] : null)); |
||
485 | $ol->appendChild($wrapper); |
||
486 | } |
||
487 | } |
||
488 | |||
489 | foreach (FieldManager::listAll() as $type) { |
||
490 | if ($type = FieldManager::create($type)) { |
||
491 | array_push($types, $type); |
||
492 | } |
||
493 | } |
||
494 | |||
495 | uasort($types, function($a, $b) { |
||
496 | return strnatcasecmp($a->_name, $b->_name); |
||
497 | }); |
||
498 | |||
499 | foreach ($types as $type) { |
||
500 | $defaults = array(); |
||
501 | |||
502 | $type->findDefaults($defaults); |
||
503 | $type->setArray($defaults); |
||
504 | |||
505 | $wrapper = new XMLElement('li'); |
||
506 | |||
507 | $wrapper->setAttribute('class', 'template field-' . $type->handle() . ($type->mustBeUnique() ? ' unique' : null)); |
||
508 | $wrapper->setAttribute('data-type', $type->handle()); |
||
509 | |||
510 | $type->set('sortorder', '-1'); |
||
511 | $type->displaySettingsPanel($wrapper); |
||
512 | |||
513 | $ol->appendChild($wrapper); |
||
514 | } |
||
515 | |||
516 | $div->appendChild($ol); |
||
517 | $fieldset->appendChild($div); |
||
518 | |||
519 | $this->Form->appendChild($fieldset); |
||
520 | |||
521 | $div = new XMLElement('div'); |
||
522 | $div->setAttribute('class', 'actions'); |
||
523 | $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's'))); |
||
524 | |||
525 | $button = new XMLElement('button', __('Delete')); |
||
526 | $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this section'), 'type' => 'submit', 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this section?'))); |
||
527 | $div->appendChild($button); |
||
528 | |||
529 | $div->appendChild(Widget::Input('action[timestamp]', $timestamp, 'hidden')); |
||
530 | $div->appendChild(Widget::Input('action[ignore-timestamp]', 'yes', 'checkbox', array('class' => 'irrelevant'))); |
||
531 | |||
532 | $this->Form->appendChild($div); |
||
533 | } |
||
534 | |||
535 | public function __actionIndex() |
||
610 | } |
||
611 | } |
||
612 | } |
||
613 | |||
614 | public function __actionNew() |
||
922 | } |
||
923 | } |
||
924 | |||
925 | public function __actionEdit() |
||
926 | { |
||
927 | return $this->__actionNew(); |
||
928 | } |
||
929 | |||
930 | public function addSectionOptions(array &$meta = null) |
||
972 | )); |
||
973 | } |
||
974 | |||
975 | /** |
||
976 | * Given $_POST values, this function will validate the current timestamp |
||
977 | * and set the proper error messages. |
||
978 | * |
||
979 | * @since Symphony 2.7.0 |
||
980 | * @param int $section_id |
||
981 | * The entry id to validate |
||
982 | * @return boolean |
||
983 | * true if the timestamp is valid |
||
984 | */ |
||
985 | protected function validateTimestamp($section_id, $checkMissing = false) |
||
1006 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.