|
17 | 17 | use Contao\Controller;
|
18 | 18 | use Contao\CoreBundle\Exception\AccessDeniedException;
|
19 | 19 | use Contao\CoreBundle\Security\ContaoCorePermissions;
|
| 20 | +use Contao\DataContainer; |
20 | 21 | use Contao\DC_Table;
|
21 | 22 | use Contao\Image;
|
22 | 23 | use Contao\Input;
|
|
30 | 31 | $GLOBALS['TL_DCA']['tl_glossary'] = [
|
31 | 32 | // Config
|
32 | 33 | 'config' => [
|
33 |
| - 'dataContainer' => DC_Table::class, |
34 |
| - 'ctable' => ['tl_glossary_item'], |
35 |
| - 'switchToEdit' => true, |
36 |
| - 'enableVersioning' => true, |
37 |
| - 'markAsCopy' => 'title', |
| 34 | + 'dataContainer' => DC_Table::class, |
| 35 | + 'ctable' => ['tl_glossary_item'], |
| 36 | + 'switchToEdit' => true, |
| 37 | + 'enableVersioning' => true, |
| 38 | + 'markAsCopy' => 'title', |
38 | 39 | 'onload_callback' => [
|
39 | 40 | ['tl_glossary', 'checkPermission'],
|
40 | 41 | ],
|
|
57 | 58 | // List
|
58 | 59 | 'list' => [
|
59 | 60 | 'sorting' => [
|
60 |
| - 'mode' => 1, |
61 |
| - 'fields' => ['title'], |
62 |
| - 'flag' => 1, |
63 |
| - 'panelLayout' => 'filter;search,limit', |
| 61 | + 'mode' => DataContainer::MODE_SORTED, |
| 62 | + 'fields' => ['title'], |
| 63 | + 'flag' => DataContainer::SORT_INITIAL_LETTER_ASC, |
| 64 | + 'panelLayout' => 'filter;search,limit', |
64 | 65 | ],
|
65 | 66 | 'label' => [
|
66 |
| - 'fields' => ['title'], |
67 |
| - 'format' => '%s', |
| 67 | + 'fields' => ['title'], |
| 68 | + 'format' => '%s', |
68 | 69 | ],
|
69 | 70 | 'global_operations' => [
|
70 | 71 | 'all' => [
|
71 |
| - 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
72 |
| - 'href' => 'act=select', |
73 |
| - 'class' => 'header_edit_all', |
74 |
| - 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"', |
| 72 | + 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
| 73 | + 'href' => 'act=select', |
| 74 | + 'class' => 'header_edit_all', |
| 75 | + 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"', |
75 | 76 | ],
|
76 | 77 | ],
|
77 | 78 | 'operations' => [
|
78 | 79 | 'edit' => [
|
79 |
| - 'href' => 'table=tl_glossary_item', |
80 |
| - 'icon' => 'edit.svg', |
| 80 | + 'href' => 'table=tl_glossary_item', |
| 81 | + 'icon' => 'edit.svg', |
81 | 82 | ],
|
82 | 83 | 'editheader' => [
|
83 |
| - 'href' => 'act=edit', |
84 |
| - 'icon' => 'header.svg', |
85 |
| - 'button_callback' => ['tl_glossary', 'editHeader'], |
| 84 | + 'href' => 'act=edit', |
| 85 | + 'icon' => 'header.svg', |
| 86 | + 'button_callback' => ['tl_glossary', 'editHeader'], |
86 | 87 | ],
|
87 | 88 | 'copy' => [
|
88 |
| - 'href' => 'act=copy', |
89 |
| - 'icon' => 'copy.svg', |
90 |
| - 'button_callback' => ['tl_glossary', 'copyArchive'], |
| 89 | + 'href' => 'act=copy', |
| 90 | + 'icon' => 'copy.svg', |
| 91 | + 'button_callback' => ['tl_glossary', 'copyArchive'], |
91 | 92 | ],
|
92 | 93 | 'delete' => [
|
93 |
| - 'href' => 'act=delete', |
94 |
| - 'icon' => 'delete.svg', |
95 |
| - 'attributes' => 'onclick="if(!confirm(\''.($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null).'\'))return false;Backend.getScrollOffset()"', |
96 |
| - 'button_callback' => ['tl_glossary', 'deleteArchive'], |
| 94 | + 'href' => 'act=delete', |
| 95 | + 'icon' => 'delete.svg', |
| 96 | + 'attributes' => 'onclick="if(!confirm(\''.($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null).'\'))return false;Backend.getScrollOffset()"', |
| 97 | + 'button_callback' => ['tl_glossary', 'deleteArchive'], |
97 | 98 | ],
|
98 | 99 | 'show' => [
|
99 |
| - 'href' => 'act=show', |
100 |
| - 'icon' => 'show.svg', |
| 100 | + 'href' => 'act=show', |
| 101 | + 'icon' => 'show.svg', |
101 | 102 | ],
|
102 | 103 | ],
|
103 | 104 | ],
|
104 | 105 |
|
105 | 106 | // Palettes
|
106 | 107 | 'palettes' => [
|
107 |
| - '__selector__' => ['protected'], |
108 |
| - 'default' => '{title_legend},title,jumpTo;{template_legend},glossaryHoverCardTemplate;{image_legend},hoverCardImgSize;{protected_legend:hide},protected', |
| 108 | + '__selector__' => ['protected'], |
| 109 | + 'default' => '{title_legend},title,jumpTo;{template_legend},glossaryHoverCardTemplate;{image_legend},hoverCardImgSize;{protected_legend:hide},protected', |
109 | 110 | ],
|
110 | 111 |
|
111 | 112 | // Subpalettes
|
112 | 113 | 'subpalettes' => [
|
113 |
| - 'protected' => 'groups', |
| 114 | + 'protected' => 'groups', |
114 | 115 | ],
|
115 | 116 |
|
116 | 117 | // Fields
|
117 | 118 | 'fields' => [
|
118 | 119 | 'id' => [
|
119 |
| - 'sql' => 'int(10) unsigned NOT NULL auto_increment', |
| 120 | + 'sql' => 'int(10) unsigned NOT NULL auto_increment', |
120 | 121 | ],
|
121 | 122 | 'tstamp' => [
|
122 |
| - 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['tstamp'], |
123 |
| - 'sql' => "int(10) unsigned NOT NULL default '0'", |
| 123 | + 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['tstamp'], |
| 124 | + 'sql' => "int(10) unsigned NOT NULL default '0'", |
124 | 125 | ],
|
125 | 126 | 'title' => [
|
126 |
| - 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['title'], |
127 |
| - 'exclude' => true, |
128 |
| - 'search' => true, |
129 |
| - 'inputType' => 'text', |
130 |
| - 'eval' => ['mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'], |
131 |
| - 'sql' => "varchar(255) NOT NULL default ''", |
| 127 | + 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['title'], |
| 128 | + 'exclude' => true, |
| 129 | + 'search' => true, |
| 130 | + 'inputType' => 'text', |
| 131 | + 'eval' => ['mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'], |
| 132 | + 'sql' => "varchar(255) NOT NULL default ''", |
132 | 133 | ],
|
133 | 134 | 'jumpTo' => [
|
134 |
| - 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['jumpTo'], |
135 |
| - 'exclude' => true, |
136 |
| - 'inputType' => 'pageTree', |
137 |
| - 'foreignKey' => 'tl_page.title', |
138 |
| - 'eval' => ['mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'], |
139 |
| - 'sql' => "int(10) unsigned NOT NULL default '0'", |
140 |
| - 'relation' => ['type' => 'hasOne', 'load' => 'lazy'], |
| 135 | + 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['jumpTo'], |
| 136 | + 'exclude' => true, |
| 137 | + 'inputType' => 'pageTree', |
| 138 | + 'foreignKey' => 'tl_page.title', |
| 139 | + 'eval' => ['mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'], |
| 140 | + 'sql' => "int(10) unsigned NOT NULL default '0'", |
| 141 | + 'relation' => ['type' => 'hasOne', 'load' => 'lazy'], |
141 | 142 | ],
|
142 | 143 | 'glossaryHoverCardTemplate' => [
|
143 |
| - 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['glossaryHoverCardTemplate'], |
144 |
| - 'default' => 'hovercard_glossary_default', |
145 |
| - 'exclude' => true, |
146 |
| - 'inputType' => 'select', |
147 |
| - 'options_callback' => static fn () => Controller::getTemplateGroup('hovercard_glossary_'), |
148 |
| - 'eval' => ['mandatory' => true, 'chosen' => true, 'tl_class' => 'w50 clr'], |
149 |
| - 'sql' => "varchar(64) NOT NULL default 'hovercard_glossary_default'", |
| 144 | + 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['glossaryHoverCardTemplate'], |
| 145 | + 'default' => 'hovercard_glossary_default', |
| 146 | + 'exclude' => true, |
| 147 | + 'inputType' => 'select', |
| 148 | + 'options_callback' => static fn () => Controller::getTemplateGroup('hovercard_glossary_'), |
| 149 | + 'eval' => ['mandatory' => true, 'chosen' => true, 'tl_class' => 'w50 clr'], |
| 150 | + 'sql' => "varchar(64) NOT NULL default 'hovercard_glossary_default'", |
150 | 151 | ],
|
151 | 152 | 'hoverCardImgSize' => [
|
152 |
| - 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['hoverCardImgSize'], |
153 |
| - 'exclude' => true, |
154 |
| - 'inputType' => 'imageSize', |
155 |
| - 'reference' => &$GLOBALS['TL_LANG']['MSC'], |
156 |
| - 'eval' => ['rgxp' => 'natural', 'includeBlankOption' => true, 'nospace' => true, 'helpwizard' => true, 'tl_class' => 'w50'], |
157 |
| - 'options_callback' => static fn () => System::getContainer()->get('contao.image.image_sizes')->getOptionsForUser(BackendUser::getInstance()), |
158 |
| - 'sql' => "varchar(64) NOT NULL default ''", |
| 153 | + 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['hoverCardImgSize'], |
| 154 | + 'exclude' => true, |
| 155 | + 'inputType' => 'imageSize', |
| 156 | + 'reference' => &$GLOBALS['TL_LANG']['MSC'], |
| 157 | + 'eval' => ['rgxp' => 'natural', 'includeBlankOption' => true, 'nospace' => true, 'helpwizard' => true, 'tl_class' => 'w50'], |
| 158 | + 'options_callback' => static fn () => System::getContainer()->get('contao.image.image_sizes')->getOptionsForUser(BackendUser::getInstance()), |
| 159 | + 'sql' => "varchar(64) NOT NULL default ''", |
159 | 160 | ],
|
160 | 161 | 'protected' => [
|
161 |
| - 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['protected'], |
162 |
| - 'exclude' => true, |
163 |
| - 'filter' => true, |
164 |
| - 'inputType' => 'checkbox', |
165 |
| - 'eval' => ['submitOnChange' => true], |
166 |
| - 'sql' => "char(1) NOT NULL default ''", |
| 162 | + 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['protected'], |
| 163 | + 'exclude' => true, |
| 164 | + 'filter' => true, |
| 165 | + 'inputType' => 'checkbox', |
| 166 | + 'eval' => ['submitOnChange' => true], |
| 167 | + 'sql' => "char(1) NOT NULL default ''", |
167 | 168 | ],
|
168 | 169 | 'groups' => [
|
169 |
| - 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['groups'], |
170 |
| - 'exclude' => true, |
171 |
| - 'inputType' => 'checkbox', |
172 |
| - 'foreignKey' => 'tl_member_group.name', |
173 |
| - 'eval' => ['mandatory' => true, 'multiple' => true], |
174 |
| - 'sql' => 'blob NULL', |
175 |
| - 'relation' => ['type' => 'hasMany', 'load' => 'lazy'], |
| 170 | + 'label' => &$GLOBALS['TL_LANG']['tl_glossary']['groups'], |
| 171 | + 'exclude' => true, |
| 172 | + 'inputType' => 'checkbox', |
| 173 | + 'foreignKey' => 'tl_member_group.name', |
| 174 | + 'eval' => ['mandatory' => true, 'multiple' => true], |
| 175 | + 'sql' => 'blob NULL', |
| 176 | + 'relation' => ['type' => 'hasMany', 'load' => 'lazy'], |
176 | 177 | ],
|
177 | 178 | ],
|
178 | 179 | ];
|
|
0 commit comments