Conditions | 5 |
Paths | 4 |
Total Lines | 32 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | protected function moveTitleAndDisplayedCheckbox(FieldList $fields) |
||
25 | { |
||
26 | foreach ($fields->fieldByName('Root.Main')->Fields() as $field) { |
||
27 | if (!$field instanceof FieldGroup) { |
||
28 | continue; |
||
29 | } |
||
30 | |||
31 | $children = $field->getChildren(); |
||
32 | if (!$children->fieldByName('Title') || !$children->fieldByName('ShowTitle')) { |
||
33 | continue; |
||
34 | } |
||
35 | |||
36 | /** @see DNADesign\Elemental\Models\BaseElement */ |
||
37 | $fields->removeByName('Titlenotdisplayedunlessspecified'); |
||
38 | |||
39 | $fields->findOrMakeTab('Root.FormFields')->unshift( |
||
40 | FieldGroup::create( |
||
41 | TextField::create('Title', ''), |
||
|
|||
42 | CheckboxField::create( |
||
43 | 'ShowTitle', |
||
44 | _t('DNADesign\\Elemental\\Models\\BaseElement\\.ShowTitleLabel', 'Displayed') |
||
45 | ) |
||
46 | ) |
||
47 | ->setTemplate('DNADesign\\Elemental\\Models\\BaseElement\\FieldGroup') |
||
48 | ->setTitle(_t( |
||
49 | 'DNADesign\\Elemental\\Models\\BaseElement\\.TitleLabel', |
||
50 | 'Title (not displayed unless specified)' |
||
51 | )) |
||
52 | ); |
||
53 | } |
||
54 | |||
55 | return $this; |
||
56 | } |
||
58 |