@@ -19,90 +19,90 @@ |
||
19 | 19 | */ |
20 | 20 | class SettingsField extends CompositeField |
21 | 21 | { |
22 | - /** |
|
23 | - * Reference to the inner upload field (ImportField). |
|
24 | - */ |
|
25 | - private $innerField = null; |
|
22 | + /** |
|
23 | + * Reference to the inner upload field (ImportField). |
|
24 | + */ |
|
25 | + private $innerField = null; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Augments a simple CompositeField with uploader and import options. |
|
29 | - * |
|
30 | - * @param $children FieldSet/array Any additional children. |
|
31 | - */ |
|
32 | - public function __construct($children = null) |
|
33 | - { |
|
34 | - if ($children) { |
|
35 | - $class = get_class(); |
|
36 | - throw new InvalidArgumentException( |
|
37 | - "${class}::__construct does not accept extra parameters." |
|
38 | - ); |
|
39 | - } |
|
27 | + /** |
|
28 | + * Augments a simple CompositeField with uploader and import options. |
|
29 | + * |
|
30 | + * @param $children FieldSet/array Any additional children. |
|
31 | + */ |
|
32 | + public function __construct($children = null) |
|
33 | + { |
|
34 | + if ($children) { |
|
35 | + $class = get_class(); |
|
36 | + throw new InvalidArgumentException( |
|
37 | + "${class}::__construct does not accept extra parameters." |
|
38 | + ); |
|
39 | + } |
|
40 | 40 | |
41 | - // Add JS specific to this field. |
|
42 | - Requirements::javascript('silverstripe/documentconverter: javascript/DocumentConversionField.js'); |
|
41 | + // Add JS specific to this field. |
|
42 | + Requirements::javascript('silverstripe/documentconverter: javascript/DocumentConversionField.js'); |
|
43 | 43 | |
44 | - $fields = FieldList::create([ |
|
45 | - HeaderField::create( |
|
46 | - 'FileWarningHeader', |
|
47 | - '<div class="alert alert-warning">' . _t( |
|
48 | - __CLASS__ . '.FileWarningHeader', |
|
49 | - 'Warning: import will remove all content and subpages of this page.' |
|
50 | - ) . '</div>', |
|
51 | - 4 |
|
52 | - ), |
|
53 | - $splitHeader = DropdownField::create( |
|
54 | - 'DocumentConversionSettings-SplitHeader', |
|
55 | - _t( |
|
56 | - __CLASS__ . '.SplitHeader', |
|
57 | - 'Split document into pages' |
|
58 | - ), |
|
59 | - [ |
|
60 | - 0 => _t(__CLASS__ . '.No', 'no'), |
|
61 | - 1 => _t(__CLASS__ . '.EachH1', 'for each heading 1'), |
|
62 | - 2 => _t(__CLASS__ . '.EachH2', 'for each heading 2') |
|
63 | - ] |
|
64 | - ), |
|
65 | - $keepSource = CheckboxField::create( |
|
66 | - 'DocumentConversionSettings-KeepSource', |
|
67 | - _t( |
|
68 | - __CLASS__ . '.KeepSource', |
|
69 | - 'Keep the original document. Adds a link to it on TOC, if enabled.' |
|
70 | - ) |
|
71 | - ), |
|
72 | - $chosenFolderID = TreeDropdownField::create( |
|
73 | - 'DocumentConversionSettings-ChosenFolderID', |
|
74 | - _t(__CLASS__ . '.ChooseFolder', 'Choose a folder to save this file'), |
|
75 | - Folder::class |
|
76 | - ), |
|
77 | - $includeTOC = CheckboxField::create( |
|
78 | - 'DocumentConversionSettings-IncludeTOC', |
|
79 | - _t(__CLASS__ . '.IncludeTOC', 'Replace this page with a Table of Contents.') |
|
80 | - ), |
|
81 | - $publishPages = CheckboxField::create( |
|
82 | - 'DocumentConversionSettings-PublishPages', |
|
83 | - _t( |
|
84 | - __CLASS__ . '.publishPages', |
|
85 | - 'Publish modified pages (not recommended unless you are sure about the conversion outcome)' |
|
86 | - ) |
|
87 | - ), |
|
88 | - $this->innerField = ImportField::create( |
|
89 | - 'ImportedFromFile', |
|
90 | - _t(__CLASS__ . '.ImportedFromFile', 'Import content from a word document') |
|
91 | - ) |
|
92 | - ]); |
|
44 | + $fields = FieldList::create([ |
|
45 | + HeaderField::create( |
|
46 | + 'FileWarningHeader', |
|
47 | + '<div class="alert alert-warning">' . _t( |
|
48 | + __CLASS__ . '.FileWarningHeader', |
|
49 | + 'Warning: import will remove all content and subpages of this page.' |
|
50 | + ) . '</div>', |
|
51 | + 4 |
|
52 | + ), |
|
53 | + $splitHeader = DropdownField::create( |
|
54 | + 'DocumentConversionSettings-SplitHeader', |
|
55 | + _t( |
|
56 | + __CLASS__ . '.SplitHeader', |
|
57 | + 'Split document into pages' |
|
58 | + ), |
|
59 | + [ |
|
60 | + 0 => _t(__CLASS__ . '.No', 'no'), |
|
61 | + 1 => _t(__CLASS__ . '.EachH1', 'for each heading 1'), |
|
62 | + 2 => _t(__CLASS__ . '.EachH2', 'for each heading 2') |
|
63 | + ] |
|
64 | + ), |
|
65 | + $keepSource = CheckboxField::create( |
|
66 | + 'DocumentConversionSettings-KeepSource', |
|
67 | + _t( |
|
68 | + __CLASS__ . '.KeepSource', |
|
69 | + 'Keep the original document. Adds a link to it on TOC, if enabled.' |
|
70 | + ) |
|
71 | + ), |
|
72 | + $chosenFolderID = TreeDropdownField::create( |
|
73 | + 'DocumentConversionSettings-ChosenFolderID', |
|
74 | + _t(__CLASS__ . '.ChooseFolder', 'Choose a folder to save this file'), |
|
75 | + Folder::class |
|
76 | + ), |
|
77 | + $includeTOC = CheckboxField::create( |
|
78 | + 'DocumentConversionSettings-IncludeTOC', |
|
79 | + _t(__CLASS__ . '.IncludeTOC', 'Replace this page with a Table of Contents.') |
|
80 | + ), |
|
81 | + $publishPages = CheckboxField::create( |
|
82 | + 'DocumentConversionSettings-PublishPages', |
|
83 | + _t( |
|
84 | + __CLASS__ . '.publishPages', |
|
85 | + 'Publish modified pages (not recommended unless you are sure about the conversion outcome)' |
|
86 | + ) |
|
87 | + ), |
|
88 | + $this->innerField = ImportField::create( |
|
89 | + 'ImportedFromFile', |
|
90 | + _t(__CLASS__ . '.ImportedFromFile', 'Import content from a word document') |
|
91 | + ) |
|
92 | + ]); |
|
93 | 93 | |
94 | - // Prevent the warning popup that appears when navigating away from the page. |
|
95 | - $splitHeader->addExtraClass('no-change-track'); |
|
96 | - $keepSource->addExtraClass('no-change-track'); |
|
97 | - $chosenFolderID->addExtraClass('no-change-track'); |
|
98 | - $includeTOC->addExtraClass('no-change-track'); |
|
99 | - $publishPages->addExtraClass('no-change-track'); |
|
94 | + // Prevent the warning popup that appears when navigating away from the page. |
|
95 | + $splitHeader->addExtraClass('no-change-track'); |
|
96 | + $keepSource->addExtraClass('no-change-track'); |
|
97 | + $chosenFolderID->addExtraClass('no-change-track'); |
|
98 | + $includeTOC->addExtraClass('no-change-track'); |
|
99 | + $publishPages->addExtraClass('no-change-track'); |
|
100 | 100 | |
101 | - return parent::__construct($fields); |
|
102 | - } |
|
101 | + return parent::__construct($fields); |
|
102 | + } |
|
103 | 103 | |
104 | - public function getInnerField() |
|
105 | - { |
|
106 | - return $this->innerField; |
|
107 | - } |
|
104 | + public function getInnerField() |
|
105 | + { |
|
106 | + return $this->innerField; |
|
107 | + } |
|
108 | 108 | } |
@@ -44,50 +44,50 @@ |
||
44 | 44 | $fields = FieldList::create([ |
45 | 45 | HeaderField::create( |
46 | 46 | 'FileWarningHeader', |
47 | - '<div class="alert alert-warning">' . _t( |
|
48 | - __CLASS__ . '.FileWarningHeader', |
|
47 | + '<div class="alert alert-warning">'._t( |
|
48 | + __CLASS__.'.FileWarningHeader', |
|
49 | 49 | 'Warning: import will remove all content and subpages of this page.' |
50 | - ) . '</div>', |
|
50 | + ).'</div>', |
|
51 | 51 | 4 |
52 | 52 | ), |
53 | 53 | $splitHeader = DropdownField::create( |
54 | 54 | 'DocumentConversionSettings-SplitHeader', |
55 | 55 | _t( |
56 | - __CLASS__ . '.SplitHeader', |
|
56 | + __CLASS__.'.SplitHeader', |
|
57 | 57 | 'Split document into pages' |
58 | 58 | ), |
59 | 59 | [ |
60 | - 0 => _t(__CLASS__ . '.No', 'no'), |
|
61 | - 1 => _t(__CLASS__ . '.EachH1', 'for each heading 1'), |
|
62 | - 2 => _t(__CLASS__ . '.EachH2', 'for each heading 2') |
|
60 | + 0 => _t(__CLASS__.'.No', 'no'), |
|
61 | + 1 => _t(__CLASS__.'.EachH1', 'for each heading 1'), |
|
62 | + 2 => _t(__CLASS__.'.EachH2', 'for each heading 2') |
|
63 | 63 | ] |
64 | 64 | ), |
65 | 65 | $keepSource = CheckboxField::create( |
66 | 66 | 'DocumentConversionSettings-KeepSource', |
67 | 67 | _t( |
68 | - __CLASS__ . '.KeepSource', |
|
68 | + __CLASS__.'.KeepSource', |
|
69 | 69 | 'Keep the original document. Adds a link to it on TOC, if enabled.' |
70 | 70 | ) |
71 | 71 | ), |
72 | 72 | $chosenFolderID = TreeDropdownField::create( |
73 | 73 | 'DocumentConversionSettings-ChosenFolderID', |
74 | - _t(__CLASS__ . '.ChooseFolder', 'Choose a folder to save this file'), |
|
74 | + _t(__CLASS__.'.ChooseFolder', 'Choose a folder to save this file'), |
|
75 | 75 | Folder::class |
76 | 76 | ), |
77 | 77 | $includeTOC = CheckboxField::create( |
78 | 78 | 'DocumentConversionSettings-IncludeTOC', |
79 | - _t(__CLASS__ . '.IncludeTOC', 'Replace this page with a Table of Contents.') |
|
79 | + _t(__CLASS__.'.IncludeTOC', 'Replace this page with a Table of Contents.') |
|
80 | 80 | ), |
81 | 81 | $publishPages = CheckboxField::create( |
82 | 82 | 'DocumentConversionSettings-PublishPages', |
83 | 83 | _t( |
84 | - __CLASS__ . '.publishPages', |
|
84 | + __CLASS__.'.publishPages', |
|
85 | 85 | 'Publish modified pages (not recommended unless you are sure about the conversion outcome)' |
86 | 86 | ) |
87 | 87 | ), |
88 | 88 | $this->innerField = ImportField::create( |
89 | 89 | 'ImportedFromFile', |
90 | - _t(__CLASS__ . '.ImportedFromFile', 'Import content from a word document') |
|
90 | + _t(__CLASS__.'.ImportedFromFile', 'Import content from a word document') |
|
91 | 91 | ) |
92 | 92 | ]); |
93 | 93 |