... | ... |
@@ -1,35 +1,39 @@ |
1 | 1 |
<?php |
2 | 2 |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
3 | 5 |
/* |
4 | 6 |
* This file is part of Oveleon ContaoMemberExtension Bundle. |
5 | 7 |
* |
6 |
- * (c) https://www.oveleon.de/ |
|
8 |
+ * @package contao-member-extension-bundle |
|
9 |
+ * @license MIT |
|
10 |
+ * @author Daniele Sciannimanica <https://github.com/doishub> |
|
11 |
+ * @author Fabian Ekert <https://github.com/eki89> |
|
12 |
+ * @author Sebastian Zoglowek <https://github.com/zoglo> |
|
13 |
+ * @copyright Oveleon <https://www.oveleon.de/> |
|
7 | 14 |
*/ |
8 | 15 |
|
9 | 16 |
// Extend the default palette |
10 | 17 |
Contao\CoreBundle\DataContainer\PaletteManipulator::create() |
11 |
- ->addField(array('avatar'), 'personal_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) |
|
18 |
+ ->addField(['avatar'], 'personal_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) |
|
12 | 19 |
->applyToPalette('default', 'tl_member') |
13 | 20 |
; |
14 | 21 |
|
15 | 22 |
// Add global operations |
16 |
-array_insert($GLOBALS['TL_DCA']['tl_member']['list']['global_operations'], 0, array |
|
17 |
-( |
|
18 |
- 'settings' => array |
|
19 |
- ( |
|
20 |
- 'label' => &$GLOBALS['TL_LANG']['tl_member']['settings'], |
|
21 |
- 'href' => 'do=member_settings', |
|
22 |
- 'icon' => 'edit.svg', |
|
23 |
- 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
24 |
- ) |
|
25 |
-)); |
|
23 |
+array_insert($GLOBALS['TL_DCA']['tl_member']['list']['global_operations'], 0, [ |
|
24 |
+ 'settings' => [ |
|
25 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member']['settings'], |
|
26 |
+ 'href' => 'do=member_settings', |
|
27 |
+ 'icon' => 'edit.svg', |
|
28 |
+ 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
29 |
+ ] |
|
30 |
+]); |
|
26 | 31 |
|
27 | 32 |
// Add fields to tl_user |
28 |
-$GLOBALS['TL_DCA']['tl_member']['fields']['avatar'] = array |
|
29 |
-( |
|
30 |
- 'label' => &$GLOBALS['TL_LANG']['tl_member']['avatar'], |
|
31 |
- 'exclude' => true, |
|
32 |
- 'inputType' => 'fileTree', |
|
33 |
- 'eval' => array('feEditable'=>true, 'feViewable'=>true, 'feGroup'=>'personal', 'fieldType'=>'radio', 'filesOnly'=>true, 'isGallery'=>true, 'extensions'=>Config::get('validImageTypes'), 'tl_class'=>'clr'), |
|
34 |
- 'sql' => "binary(16) NULL" |
|
35 |
-); |
|
36 | 33 |
\ No newline at end of file |
34 |
+$GLOBALS['TL_DCA']['tl_member']['fields']['avatar'] = [ |
|
35 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member']['avatar'], |
|
36 |
+ 'exclude' => true, |
|
37 |
+ 'inputType' => 'fileTree', |
|
38 |
+ 'eval' => ['feEditable'=>true, 'feViewable'=>true, 'feGroup'=>'personal', 'fieldType'=>'radio', 'filesOnly'=>true, 'isGallery'=>true, 'extensions'=>Config::get('validImageTypes'), 'tl_class'=>'clr'], |
|
39 |
+ 'sql' => "binary(16) NULL" |
|
40 |
+]; |
... | ... |
@@ -1,35 +1,34 @@ |
1 | 1 |
<?php |
2 | 2 |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
3 | 5 |
/* |
4 | 6 |
* This file is part of Oveleon ContaoMemberExtension Bundle. |
5 | 7 |
* |
6 |
- * (c) https://www.oveleon.de/ |
|
8 |
+ * @package contao-member-extension-bundle |
|
9 |
+ * @license MIT |
|
10 |
+ * @author Daniele Sciannimanica <https://github.com/doishub> |
|
11 |
+ * @author Fabian Ekert <https://github.com/eki89> |
|
12 |
+ * @author Sebastian Zoglowek <https://github.com/zoglo> |
|
13 |
+ * @copyright Oveleon <https://www.oveleon.de/> |
|
7 | 14 |
*/ |
8 |
- |
|
9 |
-$GLOBALS['TL_DCA']['tl_member_settings'] = array |
|
10 |
-( |
|
15 |
+$GLOBALS['TL_DCA']['tl_member_settings'] = [ |
|
11 | 16 |
|
12 | 17 |
// Config |
13 |
- 'config' => array |
|
14 |
- ( |
|
15 |
- 'dataContainer' => 'File', |
|
16 |
- 'closed' => true |
|
17 |
- ), |
|
18 |
+ 'config' => [ |
|
19 |
+ 'dataContainer' => 'File', |
|
20 |
+ 'closed' => true |
|
21 |
+ ], |
|
18 | 22 |
|
19 | 23 |
// Palettes |
20 |
- 'palettes' => array |
|
21 |
- ( |
|
22 |
- 'default' => '{avatar_legend},defaultAvatar;' |
|
23 |
- ), |
|
24 |
+ 'palettes' => ['default' =>'{avatar_legend},defaultAvatar;'], |
|
24 | 25 |
|
25 | 26 |
// Fields |
26 |
- 'fields' => array |
|
27 |
- ( |
|
28 |
- 'defaultAvatar' => array |
|
29 |
- ( |
|
30 |
- 'label' => &$GLOBALS['TL_LANG']['tl_member_settings']['defaultAvatar'], |
|
31 |
- 'inputType' => 'fileTree', |
|
32 |
- 'eval' => array('fieldType'=>'radio', 'filesOnly'=>true, 'isGallery'=>true, 'extensions'=>Config::get('validImageTypes'), 'tl_class'=>'clr') |
|
33 |
- ) |
|
34 |
- ) |
|
35 |
-); |
|
27 |
+ 'fields' => [ |
|
28 |
+ 'defaultAvatar' => [ |
|
29 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member_settings']['defaultAvatar'], |
|
30 |
+ 'inputType' => 'fileTree', |
|
31 |
+ 'eval' => array('fieldType'=>'radio', 'filesOnly'=>true, 'isGallery'=>true, 'extensions'=>Config::get('validImageTypes'), 'tl_class'=>'clr') |
|
32 |
+ ] |
|
33 |
+ ] |
|
34 |
+]; |
... | ... |
@@ -1,58 +1,54 @@ |
1 | 1 |
<?php |
2 | 2 |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
3 | 5 |
/* |
4 | 6 |
* This file is part of Oveleon ContaoMemberExtension Bundle. |
5 | 7 |
* |
6 |
- * (c) https://www.oveleon.de/ |
|
8 |
+ * @package contao-member-extension-bundle |
|
9 |
+ * @license MIT |
|
10 |
+ * @author Daniele Sciannimanica <https://github.com/doishub> |
|
11 |
+ * @author Fabian Ekert <https://github.com/eki89> |
|
12 |
+ * @author Sebastian Zoglowek <https://github.com/zoglo> |
|
13 |
+ * @copyright Oveleon <https://www.oveleon.de/> |
|
7 | 14 |
*/ |
8 | 15 |
|
9 |
-array_insert($GLOBALS['TL_DCA']['tl_module']['palettes'], 0, array |
|
10 |
-( |
|
11 |
- 'avatar' => '{title_legend},name,headline,type;{source_legend},imgSize;{template_legend:hide},memberTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID', |
|
12 |
- 'memberList' => '{title_legend},name,headline,type;{config_legend},groups,memberFields,imgSize;{redirect_legend},jumpTo;{template_legend:hide},customTpl,memberListTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID', |
|
13 |
- 'memberReader' => '{title_legend},name,headline,type;{config_legend},groups,memberFields,imgSize;{template_legend:hide},customTpl,memberReaderTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID' |
|
14 |
-)); |
|
16 |
+use Contao\Backend; |
|
17 |
+use Contao\Controller; |
|
15 | 18 |
|
16 |
-$GLOBALS['TL_DCA']['tl_module']['fields']['memberListTpl'] = array |
|
17 |
-( |
|
18 |
- 'exclude' => true, |
|
19 |
- 'inputType' => 'select', |
|
20 |
- 'options_callback' => static function () |
|
21 |
- { |
|
22 |
- return Contao\Controller::getTemplateGroup('member_list_'); |
|
23 |
- }, |
|
24 |
- 'eval' => array('includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'), |
|
25 |
- 'sql' => "varchar(64) NOT NULL default ''" |
|
26 |
-); |
|
19 |
+// Add palettes to tl_module |
|
20 |
+// ToDo: Change to ArrayUtil::arrayInsert in the future |
|
21 |
+array_insert($GLOBALS['TL_DCA']['tl_module']['palettes'], 0, [ |
|
22 |
+ 'avatar' => '{title_legend},name,headline,type;{source_legend},imgSize;{template_legend:hide},memberTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID', |
|
23 |
+ 'memberList' => '{title_legend},name,headline,type;{config_legend},groups,memberFields,imgSize;{redirect_legend},jumpTo;{template_legend:hide},customTpl,memberListTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID', |
|
24 |
+ 'memberReader' => '{title_legend},name,headline,type;{config_legend},groups,memberFields,imgSize;{template_legend:hide},customTpl,memberReaderTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID' |
|
25 |
+]); |
|
27 | 26 |
|
28 |
-$GLOBALS['TL_DCA']['tl_module']['fields']['memberReaderTpl'] = array |
|
29 |
-( |
|
30 |
- 'exclude' => true, |
|
31 |
- 'inputType' => 'select', |
|
32 |
- 'options_callback' => static function () |
|
33 |
- { |
|
34 |
- return Contao\Controller::getTemplateGroup('member_reader_'); |
|
35 |
- }, |
|
36 |
- 'eval' => array('includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'), |
|
37 |
- 'sql' => "varchar(64) NOT NULL default ''" |
|
38 |
-); |
|
27 |
+$GLOBALS['TL_DCA']['tl_module']['fields']['memberListTpl'] = [ |
|
28 |
+ 'exclude' => true, |
|
29 |
+ 'inputType' => 'select', |
|
30 |
+ 'options_callback' => static fn () => Controller::getTemplateGroup('member_list_'), |
|
31 |
+ 'eval' => ['includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'], |
|
32 |
+ 'sql' => "varchar(64) NOT NULL default ''" |
|
33 |
+]; |
|
39 | 34 |
|
40 |
-$GLOBALS['TL_DCA']['tl_module']['fields']['memberFields'] = array |
|
41 |
-( |
|
42 |
- 'exclude' => true, |
|
43 |
- 'inputType' => 'checkboxWizard', |
|
44 |
- 'options_callback' => array('tl_module_extension', 'getMemberProperties'), |
|
45 |
- 'eval' => array('multiple'=>true), |
|
46 |
- 'sql' => "blob NULL" |
|
47 |
-); |
|
35 |
+$GLOBALS['TL_DCA']['tl_module']['fields']['memberReaderTpl'] = [ |
|
36 |
+ 'exclude' => true, |
|
37 |
+ 'inputType' => 'select', |
|
38 |
+ 'options_callback' => static fn () => Controller::getTemplateGroup('member_reader_'), |
|
39 |
+ 'eval' => ['includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'], |
|
40 |
+ 'sql' => "varchar(64) NOT NULL default ''" |
|
41 |
+]; |
|
48 | 42 |
|
43 |
+$GLOBALS['TL_DCA']['tl_module']['fields']['memberFields'] = [ |
|
44 |
+ 'exclude' => true, |
|
45 |
+ 'inputType' => 'checkboxWizard', |
|
46 |
+ 'options_callback' => ['tl_module_extension', 'getMemberProperties'], |
|
47 |
+ 'eval' => ['multiple'=>true], |
|
48 |
+ 'sql' => "blob NULL" |
|
49 |
+]; |
|
49 | 50 |
|
50 |
-/** |
|
51 |
- * Provide miscellaneous methods that are used by the data configuration array. |
|
52 |
- * |
|
53 |
- * @author Daniele Sciannimanica <https://github.com/doishub> |
|
54 |
- */ |
|
55 |
-class tl_module_extension extends Contao\Backend |
|
51 |
+class tl_module_extension extends Backend |
|
56 | 52 |
{ |
57 | 53 |
/** |
58 | 54 |
* Import the back end user object |
... | ... |
@@ -70,7 +66,8 @@ class tl_module_extension extends Contao\Backend |
70 | 66 |
*/ |
71 | 67 |
public function checkPermission() |
72 | 68 |
{ |
73 |
- if ($this->User->isAdmin) { |
|
69 |
+ if ($this->User->isAdmin) |
|
70 |
+ { |
|
74 | 71 |
return; |
75 | 72 |
} |
76 | 73 |
|
... | ... |
@@ -86,7 +83,7 @@ class tl_module_extension extends Contao\Backend |
86 | 83 |
*/ |
87 | 84 |
public function getMemberProperties() |
88 | 85 |
{ |
89 |
- $return = array(); |
|
86 |
+ $return = []; |
|
90 | 87 |
|
91 | 88 |
Contao\System::loadLanguageFile('tl_member'); |
92 | 89 |
$this->loadDataContainer('tl_member'); |