Skip to content

Commit e35a820

Browse files
committed
Use the short syntax for array
1 parent a0ceadc commit e35a820

File tree

8 files changed

+83
-97
lines changed

8 files changed

+83
-97
lines changed

contao/config/autoload.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_checkbox.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -14,15 +14,17 @@
1414
* @subpackage AttributeCheckbox
1515
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1616
* @author Andreas Isaak <info@andreas-isaak.de>
17-
* @copyright 2012-2016 The MetaModels team.
17+
* @author Sven Baumann <baumann.sv@gmail.com>
18+
* @copyright 2012-2018 The MetaModels team.
1819
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0
1920
* @filesource
2021
*/
2122

2223
/**
2324
* Register the templates
2425
*/
25-
TemplateLoader::addFiles(array
26-
(
26+
TemplateLoader::addFiles(
27+
[
2728
'mm_attr_checkbox' => 'system/modules/metamodelsattribute_checkbox/templates',
28-
));
29+
]
30+
);

contao/dca/tl_metamodel_attribute.php

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,81 +24,69 @@
2424
* @filesource
2525
*/
2626

27-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['metapalettes']['checkbox extends _simpleattribute_'] = array
28-
(
29-
'+advanced' => array('check_publish', 'check_listview')
30-
);
27+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['metapalettes']['checkbox extends _simpleattribute_'] = [
28+
'+advanced' => ['check_publish', 'check_listview']
29+
];
3130

32-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['metasubpalettes'] = array
33-
(
34-
'check_listview' => array('check_inverse', 'check_listviewicon', 'check_listviewicondisabled')
35-
);
31+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['metasubpalettes'] = [
32+
'check_listview' => ['check_inverse', 'check_listviewicon', 'check_listviewicondisabled']
33+
];
3634

37-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_publish'] = array
38-
(
35+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_publish'] = [
3936
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_publish'],
4037
'exclude' => true,
4138
'inputType' => 'checkbox',
4239
'sql' => 'char(1) NOT NULL default \'\'',
43-
'eval' => array
44-
(
40+
'eval' => [
4541
'tl_class' => 'w50'
46-
),
47-
);
42+
],
43+
];
4844

49-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_listview'] = array
50-
(
45+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_listview'] = [
5146
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_listview'],
5247
'exclude' => true,
5348
'inputType' => 'checkbox',
5449
'sql' => 'char(1) NOT NULL default \'\'',
55-
'eval' => array
56-
(
50+
'eval' => [
5751
'tl_class' => 'w50',
5852
'submitOnChange' => true
59-
),
60-
);
53+
],
54+
];
6155

62-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_inverse'] = array
63-
(
56+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_inverse'] = [
6457
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_inverse'],
6558
'exclude' => true,
6659
'inputType' => 'checkbox',
6760
'sql' => 'char(1) NOT NULL default \'\'',
68-
'eval' => array
69-
(
61+
'eval' => [
7062
'tl_class' => 'w50 cbx'
71-
),
72-
);
63+
],
64+
];
7365

74-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_listviewicon'] = array
75-
(
66+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_listviewicon'] = [
7667
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_listviewicon'],
7768
'exclude' => true,
7869
'inputType' => 'fileTree',
7970
'sql' => 'blob NULL',
80-
'eval' => array
81-
(
71+
'eval' => [
8272
'fieldType' => 'radio',
8373
'files' => true,
8474
'filesOnly' => true,
8575
'extensions' => 'jpg,jpeg,gif,png,tif,tiff,svg',
8676
'tl_class' => 'clr'
87-
)
88-
);
77+
]
78+
];
8979

90-
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_listviewicondisabled'] = array
91-
(
80+
$GLOBALS['TL_DCA']['tl_metamodel_attribute']['fields']['check_listviewicondisabled'] = [
9281
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_attribute']['check_listviewicondisabled'],
9382
'exclude' => true,
9483
'inputType' => 'fileTree',
9584
'sql' => 'blob NULL',
96-
'eval' => array
97-
(
85+
'eval' => [
9886
'fieldType' => 'radio',
9987
'files' => true,
10088
'filesOnly' => true,
10189
'extensions' => 'jpg,jpeg,gif,png,tif,tiff,svg',
10290
'tl_class' => 'clr'
103-
)
104-
);
91+
]
92+
];

contao/dca/tl_metamodel_dcasetting.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_checkbox.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -17,24 +17,21 @@
1717
* @author Carolina M. Koehn <office@kikmedia.de>
1818
* @author David Maack <maack@men-at-work.de>
1919
* @author Stefan Heimes <stefan_heimes@hotmail.com>
20-
* @copyright 2012-2016 The MetaModels team.
20+
* @author Sven Baumann <baumann.sv@gmail.com>
21+
* @copyright 2012-2018 The MetaModels team.
2122
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0
2223
* @filesource
2324
*/
2425

25-
$GLOBALS['TL_DCA']['tl_metamodel_dcasetting']['metasubselectpalettes']['attr_id']['checkbox'] = array
26-
(
27-
'presentation' => array
28-
(
26+
$GLOBALS['TL_DCA']['tl_metamodel_dcasetting']['metasubselectpalettes']['attr_id']['checkbox'] = [
27+
'presentation' => [
2928
'tl_class'
30-
),
31-
'functions' => array
32-
(
29+
],
30+
'functions' => [
3331
'mandatory',
3432
'submitOnChange'
35-
),
36-
'overview' => array
37-
(
33+
],
34+
'overview' => [
3835
'filterable',
39-
)
40-
);
36+
]
37+
];

contao/dca/tl_metamodel_filtersetting.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,36 @@
1717
* @author David Maack <maack@men-at-work.de>
1818
* @author Stefan Heimes <stefan_heimes@hotmail.com>
1919
* @author Ingolf Steinhardt <info@e-spin.de>
20+
* @author Sven Baumann <baumann.sv@gmail.com>
2021
* @copyright 2012-2018 The MetaModels team.
2122
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0
2223
* @filesource
2324
*/
2425

2526
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['metapalettes']['checkbox_published extends _attribute_']['+config'] =
26-
array
27-
(
27+
[
2828
'check_ignorepublished',
2929
'check_allowpreview'
30-
);
30+
];
3131

32-
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['fields']['check_ignorepublished'] = array
33-
(
32+
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['fields']['check_ignorepublished'] = [
3433
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_filtersetting']['check_ignorepublished'],
3534
'exclude' => true,
3635
'inputType' => 'checkbox',
3736
'sql' => 'char(1) NOT NULL default \'\'',
38-
'eval' => array
39-
(
37+
'eval' => [
4038
'alwaysSave' => true,
4139
'tl_class' => 'w50 m12',
42-
),
43-
);
40+
],
41+
];
4442

45-
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['fields']['check_allowpreview'] = array
46-
(
43+
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['fields']['check_allowpreview'] = [
4744
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_filtersetting']['check_allowpreview'],
4845
'exclude' => true,
4946
'inputType' => 'checkbox',
5047
'sql' => 'char(1) NOT NULL default \'\'',
51-
'eval' => array
52-
(
48+
'eval' => [
5349
'alwaysSave' => true,
5450
'tl_class' => 'w50 m12',
55-
),
56-
);
51+
],
52+
];

src/MetaModels/Attribute/Checkbox/Checkbox.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,25 @@ public function getSQLDataType()
6363
*/
6464
public function getAttributeSettingNames()
6565
{
66-
return \array_merge(parent::getAttributeSettingNames(), array(
67-
'mandatory',
68-
'check_publish',
69-
'check_inverse',
70-
'check_listview',
71-
'check_listviewicon',
72-
'check_listviewicondisabled',
73-
'filterable',
74-
'submitOnChange'
75-
));
66+
return \array_merge(
67+
parent::getAttributeSettingNames(),
68+
[
69+
'mandatory',
70+
'check_publish',
71+
'check_inverse',
72+
'check_listview',
73+
'check_listviewicon',
74+
'check_listviewicondisabled',
75+
'filterable',
76+
'submitOnChange'
77+
]
78+
);
7679
}
7780

7881
/**
7982
* {@inheritdoc}
8083
*/
81-
public function getFieldDefinition($arrOverrides = array())
84+
public function getFieldDefinition($arrOverrides = [])
8285
{
8386
$arrFieldDef = parent::getFieldDefinition($arrOverrides);
8487
$arrFieldDef['inputType'] = 'checkbox';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function registerEventsInDispatcher()
4343
$this
4444
->addListener(
4545
BuildMetaModelOperationsEvent::NAME,
46-
array($this, 'handle')
46+
[$this, 'handle']
4747
);
4848
}
4949

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_checkbox.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -13,7 +13,8 @@
1313
* @package MetaModels
1414
* @subpackage AttributeCheckbox
1515
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
16-
* @copyright 2012-2016 The MetaModels team.
16+
* @author Sven Baumann <baumann.sv@gmail.com>
17+
* @copyright 2012-2018 The MetaModels team.
1718
* @license https://github.com/MetaModels/attribute_checkbox/blob/master/LICENSE LGPL-3.0
1819
* @filesource
1920
*/
@@ -34,7 +35,7 @@ class PublishedFilterSettingTypeRenderer extends FilterSettingTypeRenderer
3435
*/
3536
protected function getTypes()
3637
{
37-
return array('checkbox_published');
38+
return ['checkbox_published'];
3839
}
3940

4041
/**

src/MetaModels/Filter/Setting/Published/Checkbox.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,21 @@ public function prepareRules(IFilter $objFilter, $arrFilterUrl)
6060
'SELECT id FROM %s WHERE %s=?',
6161
$this->getMetaModel()->getTableName(),
6262
$objAttribute->getColName()
63-
), array($publishedValue));
63+
), [$publishedValue]);
6464
$objFilter->addFilterRule($objFilterRule);
6565

6666
return;
6767
}
6868
// No attribute found, do not return anyting.
69-
$objFilter->addFilterRule(new StaticIdList(array()));
69+
$objFilter->addFilterRule(new StaticIdList([]));
7070
}
7171

7272
/**
7373
* {@inheritdoc}
7474
*/
7575
public function getParameters()
7676
{
77-
return ($this->get('check_ignorepublished')) ? array('ignore_published' . $this->get('id')) : array();
77+
return ($this->get('check_ignorepublished')) ? ['ignore_published' . $this->get('id')] : [];
7878
}
7979

8080
/**
@@ -86,22 +86,21 @@ public function getParameters()
8686
public function getParameterDCA()
8787
{
8888
if (!$this->get('check_ignorepublished')) {
89-
return array();
89+
return [];
9090
}
9191

9292
$objAttribute = $this->getMetaModel()->getAttributeById($this->get('attr_id'));
9393

94-
$arrLabel = array();
94+
$arrLabel = [];
9595
foreach ($GLOBALS['TL_LANG']['MSC']['metamodel_filtersetting']['ignore_published'] as $strLabel) {
9696
$arrLabel[] = \sprintf($strLabel, $objAttribute->getName());
9797
}
9898

99-
return array(
100-
'ignore_published' . $this->get('id') => array
101-
(
99+
return [
100+
'ignore_published' . $this->get('id') => [
102101
'label' => $arrLabel,
103102
'inputType' => 'checkbox',
104-
)
105-
);
103+
]
104+
];
106105
}
107106
}

0 commit comments

Comments
 (0)