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