Skip to content

Commit 1cbcddf

Browse files
committed
Merge tag '2.0.4'
Hotfix release 2.0.4 - Disable the toggle command if the attribute is read only - Hotfix correct dca, view check_inverse permanently
2 parents 8dbdc16 + 6f62638 commit 1cbcddf

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

contao/dca/tl_metamodel_attribute.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
* @author Sven Baumann <baumann.sv@gmail.com>
2121
* @author Ingolf Steinhardt <info@e-spin.de>
2222
* @copyright 2012-2018 The MetaModels team.
23-
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0
23+
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0-or-later
2424
* @filesource
2525
*/
2626

2727
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['metapalettes']['checkbox extends _simpleattribute_'] = [
28-
'+advanced' => ['check_publish', 'check_listview']
28+
'+advanced' => ['check_publish', 'check_inverse', 'check_listview']
2929
];
3030

3131
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['metasubpalettes'] = [
32-
'check_listview' => ['check_inverse', 'check_listviewicon', 'check_listviewicondisabled']
32+
'check_listview' => ['check_listviewicon', 'check_listviewicondisabled']
3333
];
3434

3535
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_publish'] = [
@@ -38,28 +38,28 @@
3838
'inputType' => 'checkbox',
3939
'sql' => 'char(1) NOT NULL default \'\'',
4040
'eval' => [
41-
'tl_class' => 'w50'
41+
'tl_class' => 'cbx w50'
4242
],
4343
];
4444

45-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_listview'] = [
46-
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_listview'],
45+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_inverse'] = [
46+
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_inverse'],
4747
'exclude' => true,
4848
'inputType' => 'checkbox',
4949
'sql' => 'char(1) NOT NULL default \'\'',
5050
'eval' => [
51-
'tl_class' => 'w50',
52-
'submitOnChange' => true
51+
'tl_class' => 'cbx w50'
5352
],
5453
];
5554

56-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_inverse'] = [
57-
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_inverse'],
55+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_listview'] = [
56+
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_listview'],
5857
'exclude' => true,
5958
'inputType' => 'checkbox',
6059
'sql' => 'char(1) NOT NULL default \'\'',
6160
'eval' => [
62-
'tl_class' => 'w50 cbx'
61+
'tl_class' => 'clr cbx w50',
62+
'submitOnChange' => true
6363
],
6464
];
6565

@@ -73,7 +73,7 @@
7373
'files' => true,
7474
'filesOnly' => true,
7575
'extensions' => 'jpg,jpeg,gif,png,tif,tiff,svg',
76-
'tl_class' => 'clr'
76+
'tl_class' => 'clr w50'
7777
]
7878
];
7979

@@ -87,6 +87,6 @@
8787
'files' => true,
8888
'filesOnly' => true,
8989
'extensions' => 'jpg,jpeg,gif,png,tif,tiff,svg',
90-
'tl_class' => 'clr'
90+
'tl_class' => 'w50'
9191
]
9292
];

contao/dca/tl_metamodel_dcasetting.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
* @subpackage AttributeCheckbox
1515
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1616
* @author Andreas Isaak <info@andreas-isaak.de>
17-
* @author Carolina M. Koehn <office@kikmedia.de>
18-
* @author David Maack <maack@men-at-work.de>
1917
* @author Stefan Heimes <stefan_heimes@hotmail.com>
2018
* @author Sven Baumann <baumann.sv@gmail.com>
19+
* @author Ingolf Steinhardt <info@e-spin.de>
2120
* @copyright 2012-2018 The MetaModels team.
22-
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0
21+
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0-or-later
2322
* @filesource
2423
*/
2524

contao/dca/tl_metamodel_filtersetting.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
* @subpackage AttributeCheckbox
1515
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1616
* @author Andreas Isaak <info@andreas-isaak.de>
17-
* @author David Maack <maack@men-at-work.de>
18-
* @author Stefan Heimes <stefan_heimes@hotmail.com>
1917
* @author Ingolf Steinhardt <info@e-spin.de>
2018
* @author Sven Baumann <baumann.sv@gmail.com>
2119
* @copyright 2012-2018 The MetaModels team.
22-
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0
20+
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0-or-later
2321
* @filesource
2422
*/
2523

src/MetaModels/Events/Attribute/Checkbox/Listener.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ public function registerEventsInDispatcher()
5151
/**
5252
* Build a single toggle operation.
5353
*
54-
* @param Checkbox $attribute The checkbox attribute.
54+
* @param Checkbox $attribute The checkbox attribute.
55+
* @param array $propertyData The property date from the input screen property.
5556
*
5657
* @return ToggleCommandInterface
5758
*
5859
* @SuppressWarnings(PHPMD.Superglobals)
5960
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
6061
*/
61-
protected function buildCommand($attribute)
62+
private function buildCommand($attribute, array $propertyData)
6263
{
6364
if ($attribute->get('check_listview') == 1) {
6465
$commandName = 'listviewtoggle_' . $attribute->getColName();
@@ -92,6 +93,10 @@ protected function buildCommand($attribute)
9293
$toggle->setInverse(true);
9394
}
9495

96+
if (!empty($propertyData['info']['eval']['readonly'])) {
97+
$toggle->setDisabled(true);
98+
}
99+
95100
return $toggle;
96101
}
97102

@@ -116,8 +121,9 @@ public function handle(BuildMetaModelOperationsEvent $event)
116121
continue;
117122
}
118123

119-
$toggle = $this->buildCommand($attribute);
120-
$container = $event->getContainer();
124+
$propertyData = $event->getInputScreen()->getProperty($attribute->getColName());
125+
$toggle = $this->buildCommand($attribute, $propertyData);
126+
$container = $event->getContainer();
121127

122128
if ($container->hasDefinition(Contao2BackendViewDefinitionInterface::NAME)) {
123129
$view = $container->getDefinition(Contao2BackendViewDefinitionInterface::NAME);

0 commit comments

Comments
 (0)