Skip to content

Commit 80ae858

Browse files
committed
CS
1 parent 05ccd3e commit 80ae858

File tree

9 files changed

+450
-491
lines changed

9 files changed

+450
-491
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88

99
# IDE
1010
/.idea
11+
12+
# Node modules
13+
/node_modules

composer.json

Lines changed: 57 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,61 @@
11
{
2-
"name": "oveleon/contao-glossary-bundle",
3-
"type": "contao-bundle",
4-
"description": "A glossary extension for the Contao Open Source CMS. Glossaries are organized in archives similar to news and events and can be displayed via a list and reader module.",
5-
"license":"AGPL-3.0-or-later",
6-
"authors": [
7-
{
8-
"name": "Fabian Ekert",
9-
"homepage": "https://github.com/eki89"
10-
},
11-
{
12-
"name": "Sebastian Zoglowek",
13-
"homepage": "https://github.com/zoglo"
14-
}
2+
"name": "oveleon/contao-glossary-bundle",
3+
"type": "contao-bundle",
4+
"description": "A glossary extension for the Contao Open Source CMS. Glossaries are organized in archives similar to news and events and can be displayed via a list and reader module.",
5+
"license": "AGPL-3.0-or-later",
6+
"authors": [
7+
{
8+
"name": "Fabian Ekert",
9+
"homepage": "https://github.com/eki89"
10+
},
11+
{
12+
"name": "Sebastian Zoglowek",
13+
"homepage": "https://github.com/zoglo"
14+
}
15+
],
16+
"require": {
17+
"php": "^8.1",
18+
"ext-json": "*",
19+
"contao/core-bundle": "^4.13 || ^5.1",
20+
"symfony/http-foundation": "^5.4 || ^6.0",
21+
"symfony/string": "^5.4 || ^6.0"
22+
},
23+
"require-dev": {
24+
"contao/manager-plugin": "^2.3.1"
25+
},
26+
"conflict": {
27+
"contao/core": "*",
28+
"contao/manager-plugin": "<2.0 || >=3.0"
29+
},
30+
"autoload": {
31+
"psr-4": {
32+
"Oveleon\\ContaoGlossaryBundle\\": "src/"
33+
},
34+
"classmap": [
35+
"contao/"
1536
],
16-
"require": {
17-
"php": "^8.1",
18-
"ext-json":"*",
19-
"contao/core-bundle": "^4.13 || ^5.1",
20-
"symfony/http-foundation": "^5.4 || ^6.0",
21-
"symfony/string": "^5.4 || ^6.0"
22-
},
23-
"conflict": {
24-
"contao/core": "*",
25-
"contao/manager-plugin": "<2.0 || >=3.0"
26-
},
27-
"require-dev": {
28-
"contao/manager-plugin": "^2.3.1",
29-
"contao/easy-coding-standard": "^3.4",
30-
"rector/rector": "^0.17.7"
31-
},
32-
"extra": {
33-
"branch-alias": {
34-
"dev-main": "2.1.x-dev"
35-
},
36-
"contao-manager-plugin": "Oveleon\\ContaoGlossaryBundle\\ContaoManager\\Plugin"
37-
},
38-
"autoload": {
39-
"psr-4": {
40-
"Oveleon\\ContaoGlossaryBundle\\": "src/"
41-
},
42-
"classmap": [
43-
"contao/"
44-
],
45-
"exclude-from-classmap": [
46-
"contao/config/",
47-
"contao/dca/",
48-
"contao/languages/",
49-
"contao/templates/"
50-
]
51-
},
52-
"autoload-dev": {
53-
"psr-4": {
54-
"Contao\\ContaoGlossaryBundle\\Tests\\": "tests/"
55-
}
56-
},
57-
"support": {
58-
"issues": "https://github.com/oveleon/contao-glossary-bundle/issues",
59-
"source": "https://github.com/oveleon/contao-glossary-bundle"
60-
},
61-
"scripts": {
62-
"cs-fixer": [
63-
"vendor/bin/ecs check src/ --fix --ansi"
64-
]
65-
},
66-
"config": {
67-
"allow-plugins": {
68-
"php-http/discovery": true,
69-
"dealerdirect/phpcodesniffer-composer-installer": true,
70-
"contao/manager-plugin": true
71-
}
37+
"exclude-from-classmap": [
38+
"contao/config/",
39+
"contao/dca/",
40+
"contao/languages/",
41+
"contao/templates/"
42+
]
43+
},
44+
"extra": {
45+
"branch-alias": {
46+
"dev-main": "2.1.x-dev"
47+
},
48+
"contao-manager-plugin": "Oveleon\\ContaoGlossaryBundle\\ContaoManager\\Plugin"
49+
},
50+
"config": {
51+
"allow-plugins": {
52+
"php-http/discovery": true,
53+
"dealerdirect/phpcodesniffer-composer-installer": true,
54+
"contao/manager-plugin": true
7255
}
56+
},
57+
"support": {
58+
"issues": "https://github.com/oveleon/contao-glossary-bundle/issues",
59+
"source": "https://github.com/oveleon/contao-glossary-bundle"
60+
}
7361
}

contao/dca/tl_glossary.php

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Contao\Controller;
1818
use Contao\CoreBundle\Exception\AccessDeniedException;
1919
use Contao\CoreBundle\Security\ContaoCorePermissions;
20+
use Contao\DataContainer;
2021
use Contao\DC_Table;
2122
use Contao\Image;
2223
use Contao\Input;
@@ -30,11 +31,11 @@
3031
$GLOBALS['TL_DCA']['tl_glossary'] = [
3132
// Config
3233
'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',
3839
'onload_callback' => [
3940
['tl_glossary', 'checkPermission'],
4041
],
@@ -57,122 +58,122 @@
5758
// List
5859
'list' => [
5960
'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',
6465
],
6566
'label' => [
66-
'fields' => ['title'],
67-
'format' => '%s',
67+
'fields' => ['title'],
68+
'format' => '%s',
6869
],
6970
'global_operations' => [
7071
'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"',
7576
],
7677
],
7778
'operations' => [
7879
'edit' => [
79-
'href' => 'table=tl_glossary_item',
80-
'icon' => 'edit.svg',
80+
'href' => 'table=tl_glossary_item',
81+
'icon' => 'edit.svg',
8182
],
8283
'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'],
8687
],
8788
'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'],
9192
],
9293
'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'],
9798
],
9899
'show' => [
99-
'href' => 'act=show',
100-
'icon' => 'show.svg',
100+
'href' => 'act=show',
101+
'icon' => 'show.svg',
101102
],
102103
],
103104
],
104105

105106
// Palettes
106107
'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',
109110
],
110111

111112
// Subpalettes
112113
'subpalettes' => [
113-
'protected' => 'groups',
114+
'protected' => 'groups',
114115
],
115116

116117
// Fields
117118
'fields' => [
118119
'id' => [
119-
'sql' => 'int(10) unsigned NOT NULL auto_increment',
120+
'sql' => 'int(10) unsigned NOT NULL auto_increment',
120121
],
121122
'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'",
124125
],
125126
'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 ''",
132133
],
133134
'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'],
141142
],
142143
'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'",
150151
],
151152
'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 ''",
159160
],
160161
'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 ''",
167168
],
168169
'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'],
176177
],
177178
],
178179
];

0 commit comments

Comments
 (0)