@@ -33,36 +33,36 @@ |
||
33 | 33 | */ |
34 | 34 | class TableServiceTest extends AbstractServiceTest |
35 | 35 | { |
36 | - /** |
|
37 | - * @var TableService |
|
38 | - */ |
|
39 | - private $fixture; |
|
36 | + /** |
|
37 | + * @var TableService |
|
38 | + */ |
|
39 | + private $fixture; |
|
40 | 40 | |
41 | - public function setUp() |
|
42 | - { |
|
43 | - parent::setUp(); |
|
44 | - $this->fixture = new TableService('tx_foo', Tca::TYPE_TABLE); |
|
45 | - } |
|
41 | + public function setUp() |
|
42 | + { |
|
43 | + parent::setUp(); |
|
44 | + $this->fixture = new TableService('tx_foo', Tca::TYPE_TABLE); |
|
45 | + } |
|
46 | 46 | |
47 | - public function tearDown() |
|
48 | - { |
|
49 | - unset($this->fixture); |
|
50 | - } |
|
47 | + public function tearDown() |
|
48 | + { |
|
49 | + unset($this->fixture); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @test |
|
54 | - */ |
|
55 | - public function getLabelReturnNameAsValue() |
|
56 | - { |
|
57 | - $this->assertEquals('username', $this->fixture->getLabelField()); |
|
58 | - } |
|
52 | + /** |
|
53 | + * @test |
|
54 | + */ |
|
55 | + public function getLabelReturnNameAsValue() |
|
56 | + { |
|
57 | + $this->assertEquals('username', $this->fixture->getLabelField()); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @test |
|
62 | - */ |
|
63 | - public function getSearchableFieldsIsNotEmptyByDefaultForTableSysFile() |
|
64 | - { |
|
65 | - $actual = $this->fixture->getSearchFields(); |
|
66 | - $this->assertNotEmpty($actual); |
|
67 | - } |
|
60 | + /** |
|
61 | + * @test |
|
62 | + */ |
|
63 | + public function getSearchableFieldsIsNotEmptyByDefaultForTableSysFile() |
|
64 | + { |
|
65 | + $actual = $this->fixture->getSearchFields(); |
|
66 | + $this->assertNotEmpty($actual); |
|
67 | + } |
|
68 | 68 | } |
@@ -22,186 +22,186 @@ |
||
22 | 22 | */ |
23 | 23 | class GridServiceTest extends AbstractServiceTest |
24 | 24 | { |
25 | - /** |
|
26 | - * @var GridService |
|
27 | - */ |
|
28 | - private $fixture; |
|
29 | - |
|
30 | - public function setUp() |
|
31 | - { |
|
32 | - parent::setUp(); |
|
33 | - $this->fixture = $this->getMock('Fab\Vidi\Tca\GridService', array('getModulePreferences'), array('tx_foo', Tca::TYPE_GRID)); |
|
34 | - |
|
35 | - // Configure the ModulePreferences |
|
36 | - $mockModulePreferences = $this->getMock('Fab\Vidi\Module\ModulePreferences'); |
|
37 | - $mockModulePreferences->expects($this->once())->method('get')->will($this->returnValue(array())); |
|
38 | - $this->fixture->expects($this->once())->method('getModulePreferences')->will($this->returnValue($mockModulePreferences)); |
|
39 | - |
|
40 | - $GLOBALS['BE_USER'] = $this->getMock('TYPO3\CMS\Core\Authentication\BackendUserAuthentication', [], [], '', false); |
|
41 | - $GLOBALS['BE_USER']->expects($this->any())->method('isAdmin')->will($this->returnValue(true)); |
|
42 | - } |
|
43 | - |
|
44 | - public function tearDown() |
|
45 | - { |
|
46 | - unset($this->fixture); |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * test |
|
51 | - */ |
|
52 | - #public function getLabelReturnNameAsValue() { |
|
53 | - # $GLOBALS['LANG'] = $this->getMock('TYPO3\CMS\Core\Localization\LanguageService', [], [], '', false); |
|
54 | - # $GLOBALS['LANG']->expects($this->once())->method('sL')->will($this->returnValue('Name')); |
|
55 | - # |
|
56 | - # $this->assertEquals('Name', $this->fixture->getLabel('name')); |
|
57 | - #} |
|
58 | - |
|
59 | - /** |
|
60 | - * @test |
|
61 | - */ |
|
62 | - public function getFieldNamesReturnsNotEmpty() |
|
63 | - { |
|
64 | - $actual = $this->fixture->getFieldNames(); |
|
65 | - |
|
66 | - $this->assertTrue(is_array($actual)); |
|
67 | - $this->assertNotEmpty($actual); |
|
68 | - $this->assertTrue(in_array('username', $actual)); |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * @test |
|
73 | - */ |
|
74 | - public function getColumnsReturnsAnNotEmptyArray() |
|
75 | - { |
|
76 | - $actual = $this->fixture->getFields(); |
|
77 | - $this->assertTrue(is_array($actual)); |
|
78 | - $this->assertNotEmpty($actual); |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * @test |
|
83 | - */ |
|
84 | - public function getFieldsReturnsGreaterThanNumberOfColumns() |
|
85 | - { |
|
86 | - $actual = $this->fixture->getFields(); |
|
87 | - $this->assertGreaterThanOrEqual(count($actual), count($GLOBALS['TCA']['tx_foo']['columns'])); |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @test |
|
92 | - */ |
|
93 | - public function additionalFieldsAreHiddenByDefault() |
|
94 | - { |
|
95 | - $actual = $this->fixture->getFields(); |
|
96 | - $this->assertFalse($actual['birthday']['visible']); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @test |
|
101 | - */ |
|
102 | - public function additionalFieldBirthDayIsFormattedAsDate() |
|
103 | - { |
|
104 | - $actual = $this->fixture->getFields(); |
|
105 | - $this->assertEquals('Fab\Vidi\Formatter\Date', $actual['birthday']['format']); |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * @test |
|
110 | - */ |
|
111 | - public function additionalFieldStartTimeIsFormattedAsDateTime() |
|
112 | - { |
|
113 | - $actual = $this->fixture->getFields(); |
|
114 | - $this->assertEquals('Fab\Vidi\Formatter\Datetime', $actual['starttime']['format']); |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * @test |
|
119 | - */ |
|
120 | - public function getConfigurationForColumnUsername() |
|
121 | - { |
|
122 | - $actual = $this->fixture->getField('username'); |
|
123 | - $this->assertTrue(is_array($actual)); |
|
124 | - $this->assertTrue(count($actual) > 0); |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * @test |
|
129 | - */ |
|
130 | - public function additionalColumnFirstNameShouldNotBeVisible() |
|
131 | - { |
|
132 | - $actual = $this->fixture->isVisible('first_name'); |
|
133 | - $this->assertFalse($actual); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * @test |
|
138 | - */ |
|
139 | - public function columnUsernameShouldBeSortableByDefault() |
|
140 | - { |
|
141 | - $this->assertTrue($this->fixture->isSortable('username')); |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * @test |
|
146 | - */ |
|
147 | - public function columnNumberShouldBeNotSortableByDefault() |
|
148 | - { |
|
149 | - $this->assertFalse($this->fixture->isSortable('usergroup')); |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * @test |
|
154 | - */ |
|
155 | - public function getExcludedFieldsReturnsArray() |
|
156 | - { |
|
157 | - $result = $this->fixture->getExcludedFields(); |
|
158 | - $this->assertInternalType('array', $result); |
|
159 | - } |
|
160 | - |
|
161 | - /** |
|
162 | - * @test |
|
163 | - */ |
|
164 | - public function getFieldsRemoveFieldMiddleNameFromResultSet() |
|
165 | - { |
|
166 | - $result = $this->fixture->getFields(); |
|
167 | - $this->assertArrayNotHasKey('middle_name', $result); |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * @test |
|
172 | - */ |
|
173 | - public function columnUsernameShouldBeVisibleByDefault() |
|
174 | - { |
|
175 | - $this->assertTrue($this->fixture->isVisible('username')); |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @test |
|
180 | - */ |
|
181 | - public function getConfigurationOfNotExistingColumnReturnsAnException() |
|
182 | - { |
|
183 | - $expected = []; |
|
184 | - $this->assertEquals($expected, $this->fixture->getRenderers('bar')); |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
188 | - * @test |
|
189 | - */ |
|
190 | - public function getFieldsAndCheckWhetherItsPositionReturnsTheCorrectFieldName() |
|
191 | - { |
|
192 | - $fields = array_keys($this->fixture->getFields()); |
|
193 | - for ($index = 0; $index < count($fields); $index++) { |
|
194 | - $actual = $this->fixture->getFieldNameByPosition($index); |
|
195 | - $this->assertSame($fields[$index], $actual); |
|
196 | - } |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * @test |
|
201 | - */ |
|
202 | - public function canGetLabelKeyCodeForFakeFieldUserGroups() |
|
203 | - { |
|
204 | - $fieldName = 'usergroup'; |
|
205 | - $this->assertEquals($GLOBALS['TCA']['tx_foo']['grid']['columns'][$fieldName]['label'], $this->fixture->getLabelKey($fieldName)); |
|
206 | - } |
|
25 | + /** |
|
26 | + * @var GridService |
|
27 | + */ |
|
28 | + private $fixture; |
|
29 | + |
|
30 | + public function setUp() |
|
31 | + { |
|
32 | + parent::setUp(); |
|
33 | + $this->fixture = $this->getMock('Fab\Vidi\Tca\GridService', array('getModulePreferences'), array('tx_foo', Tca::TYPE_GRID)); |
|
34 | + |
|
35 | + // Configure the ModulePreferences |
|
36 | + $mockModulePreferences = $this->getMock('Fab\Vidi\Module\ModulePreferences'); |
|
37 | + $mockModulePreferences->expects($this->once())->method('get')->will($this->returnValue(array())); |
|
38 | + $this->fixture->expects($this->once())->method('getModulePreferences')->will($this->returnValue($mockModulePreferences)); |
|
39 | + |
|
40 | + $GLOBALS['BE_USER'] = $this->getMock('TYPO3\CMS\Core\Authentication\BackendUserAuthentication', [], [], '', false); |
|
41 | + $GLOBALS['BE_USER']->expects($this->any())->method('isAdmin')->will($this->returnValue(true)); |
|
42 | + } |
|
43 | + |
|
44 | + public function tearDown() |
|
45 | + { |
|
46 | + unset($this->fixture); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * test |
|
51 | + */ |
|
52 | + #public function getLabelReturnNameAsValue() { |
|
53 | + # $GLOBALS['LANG'] = $this->getMock('TYPO3\CMS\Core\Localization\LanguageService', [], [], '', false); |
|
54 | + # $GLOBALS['LANG']->expects($this->once())->method('sL')->will($this->returnValue('Name')); |
|
55 | + # |
|
56 | + # $this->assertEquals('Name', $this->fixture->getLabel('name')); |
|
57 | + #} |
|
58 | + |
|
59 | + /** |
|
60 | + * @test |
|
61 | + */ |
|
62 | + public function getFieldNamesReturnsNotEmpty() |
|
63 | + { |
|
64 | + $actual = $this->fixture->getFieldNames(); |
|
65 | + |
|
66 | + $this->assertTrue(is_array($actual)); |
|
67 | + $this->assertNotEmpty($actual); |
|
68 | + $this->assertTrue(in_array('username', $actual)); |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * @test |
|
73 | + */ |
|
74 | + public function getColumnsReturnsAnNotEmptyArray() |
|
75 | + { |
|
76 | + $actual = $this->fixture->getFields(); |
|
77 | + $this->assertTrue(is_array($actual)); |
|
78 | + $this->assertNotEmpty($actual); |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * @test |
|
83 | + */ |
|
84 | + public function getFieldsReturnsGreaterThanNumberOfColumns() |
|
85 | + { |
|
86 | + $actual = $this->fixture->getFields(); |
|
87 | + $this->assertGreaterThanOrEqual(count($actual), count($GLOBALS['TCA']['tx_foo']['columns'])); |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @test |
|
92 | + */ |
|
93 | + public function additionalFieldsAreHiddenByDefault() |
|
94 | + { |
|
95 | + $actual = $this->fixture->getFields(); |
|
96 | + $this->assertFalse($actual['birthday']['visible']); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @test |
|
101 | + */ |
|
102 | + public function additionalFieldBirthDayIsFormattedAsDate() |
|
103 | + { |
|
104 | + $actual = $this->fixture->getFields(); |
|
105 | + $this->assertEquals('Fab\Vidi\Formatter\Date', $actual['birthday']['format']); |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * @test |
|
110 | + */ |
|
111 | + public function additionalFieldStartTimeIsFormattedAsDateTime() |
|
112 | + { |
|
113 | + $actual = $this->fixture->getFields(); |
|
114 | + $this->assertEquals('Fab\Vidi\Formatter\Datetime', $actual['starttime']['format']); |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * @test |
|
119 | + */ |
|
120 | + public function getConfigurationForColumnUsername() |
|
121 | + { |
|
122 | + $actual = $this->fixture->getField('username'); |
|
123 | + $this->assertTrue(is_array($actual)); |
|
124 | + $this->assertTrue(count($actual) > 0); |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * @test |
|
129 | + */ |
|
130 | + public function additionalColumnFirstNameShouldNotBeVisible() |
|
131 | + { |
|
132 | + $actual = $this->fixture->isVisible('first_name'); |
|
133 | + $this->assertFalse($actual); |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * @test |
|
138 | + */ |
|
139 | + public function columnUsernameShouldBeSortableByDefault() |
|
140 | + { |
|
141 | + $this->assertTrue($this->fixture->isSortable('username')); |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * @test |
|
146 | + */ |
|
147 | + public function columnNumberShouldBeNotSortableByDefault() |
|
148 | + { |
|
149 | + $this->assertFalse($this->fixture->isSortable('usergroup')); |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * @test |
|
154 | + */ |
|
155 | + public function getExcludedFieldsReturnsArray() |
|
156 | + { |
|
157 | + $result = $this->fixture->getExcludedFields(); |
|
158 | + $this->assertInternalType('array', $result); |
|
159 | + } |
|
160 | + |
|
161 | + /** |
|
162 | + * @test |
|
163 | + */ |
|
164 | + public function getFieldsRemoveFieldMiddleNameFromResultSet() |
|
165 | + { |
|
166 | + $result = $this->fixture->getFields(); |
|
167 | + $this->assertArrayNotHasKey('middle_name', $result); |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * @test |
|
172 | + */ |
|
173 | + public function columnUsernameShouldBeVisibleByDefault() |
|
174 | + { |
|
175 | + $this->assertTrue($this->fixture->isVisible('username')); |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @test |
|
180 | + */ |
|
181 | + public function getConfigurationOfNotExistingColumnReturnsAnException() |
|
182 | + { |
|
183 | + $expected = []; |
|
184 | + $this->assertEquals($expected, $this->fixture->getRenderers('bar')); |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | + * @test |
|
189 | + */ |
|
190 | + public function getFieldsAndCheckWhetherItsPositionReturnsTheCorrectFieldName() |
|
191 | + { |
|
192 | + $fields = array_keys($this->fixture->getFields()); |
|
193 | + for ($index = 0; $index < count($fields); $index++) { |
|
194 | + $actual = $this->fixture->getFieldNameByPosition($index); |
|
195 | + $this->assertSame($fields[$index], $actual); |
|
196 | + } |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * @test |
|
201 | + */ |
|
202 | + public function canGetLabelKeyCodeForFakeFieldUserGroups() |
|
203 | + { |
|
204 | + $fieldName = 'usergroup'; |
|
205 | + $this->assertEquals($GLOBALS['TCA']['tx_foo']['grid']['columns'][$fieldName]['label'], $this->fixture->getLabelKey($fieldName)); |
|
206 | + } |
|
207 | 207 | } |
@@ -10,158 +10,158 @@ discard block |
||
10 | 10 | */ |
11 | 11 | abstract class AbstractServiceTest extends UnitTestCase |
12 | 12 | { |
13 | - /** |
|
14 | - * @var GridService |
|
15 | - */ |
|
16 | - private $fixture; |
|
13 | + /** |
|
14 | + * @var GridService |
|
15 | + */ |
|
16 | + private $fixture; |
|
17 | 17 | |
18 | - public function setUp() |
|
19 | - { |
|
20 | - parent::setUp(); |
|
18 | + public function setUp() |
|
19 | + { |
|
20 | + parent::setUp(); |
|
21 | 21 | |
22 | - $GLOBALS['TCA']['tx_foo'] = array( |
|
23 | - 'ctrl' => array( |
|
24 | - 'label' => 'username', |
|
25 | - 'default_sortby' => 'ORDER BY username', |
|
26 | - 'tstamp' => 'tstamp', |
|
27 | - 'crdate' => 'crdate', |
|
28 | - 'cruser_id' => 'cruser_id', |
|
29 | - 'title' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:tx_foo', |
|
30 | - 'delete' => 'deleted', |
|
31 | - 'enablecolumns' => array( |
|
32 | - 'disabled' => 'disable', |
|
33 | - 'starttime' => 'starttime', |
|
34 | - 'endtime' => 'endtime' |
|
35 | - ), |
|
36 | - 'typeicon_classes' => array( |
|
37 | - 'default' => 'status-user-frontend' |
|
38 | - ), |
|
39 | - 'searchFields' => 'username,name,first_name,last_name' |
|
40 | - ), |
|
41 | - 'columns' => array( |
|
42 | - 'username' => array( |
|
43 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:username', |
|
44 | - 'config' => array( |
|
45 | - 'type' => 'input', |
|
46 | - 'size' => '20', |
|
47 | - 'max' => '255', |
|
48 | - 'eval' => 'nospace,lower,uniqueInPid,required' |
|
49 | - ), |
|
50 | - ), |
|
51 | - 'password' => array( |
|
52 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:password', |
|
53 | - 'config' => array( |
|
54 | - 'type' => 'input', |
|
55 | - 'size' => '10', |
|
56 | - 'max' => '40', |
|
57 | - 'eval' => 'nospace,required,password' |
|
58 | - ), |
|
59 | - ), |
|
60 | - 'usergroup' => array( |
|
61 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:usergroup', |
|
62 | - 'config' => array( |
|
63 | - 'type' => 'select', |
|
64 | - 'renderType' => 'selectMultipleSideBySide', |
|
65 | - 'foreign_table' => 'fe_groups', |
|
66 | - 'foreign_table_where' => 'ORDER BY fe_groups.title', |
|
67 | - 'size' => '6', |
|
68 | - 'minitems' => '1', |
|
69 | - 'maxitems' => '50' |
|
70 | - ), |
|
71 | - ), |
|
72 | - 'name' => array( |
|
73 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:name', |
|
74 | - 'config' => array( |
|
75 | - 'type' => 'input', |
|
76 | - 'size' => '40', |
|
77 | - 'eval' => 'trim', |
|
78 | - 'max' => '80' |
|
79 | - ), |
|
80 | - ), |
|
81 | - 'first_name' => array( |
|
82 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:first_name', |
|
83 | - 'config' => array( |
|
84 | - 'type' => 'input', |
|
85 | - 'size' => '25', |
|
86 | - 'eval' => 'trim', |
|
87 | - 'max' => '50' |
|
88 | - ), |
|
89 | - ), |
|
90 | - 'last_name' => array( |
|
91 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:last_name', |
|
92 | - 'config' => array( |
|
93 | - 'type' => 'input', |
|
94 | - 'size' => '25', |
|
95 | - 'eval' => 'trim', |
|
96 | - 'max' => '50' |
|
97 | - ), |
|
98 | - ), |
|
99 | - 'middle_name' => array( |
|
100 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:middle_name', |
|
101 | - 'config' => array( |
|
102 | - 'type' => 'input', |
|
103 | - 'size' => '25', |
|
104 | - 'eval' => 'trim', |
|
105 | - 'max' => '50' |
|
106 | - ), |
|
107 | - ), |
|
108 | - 'alternative_name' => array( |
|
109 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:alternative_name', |
|
110 | - 'config' => array( |
|
111 | - 'type' => 'input', |
|
112 | - 'size' => '25', |
|
113 | - 'eval' => 'trim', |
|
114 | - 'max' => '50' |
|
115 | - ), |
|
116 | - ), |
|
117 | - 'birthday' => array( |
|
118 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:birthday', |
|
119 | - 'config' => array( |
|
120 | - 'type' => 'input', |
|
121 | - 'size' => '25', |
|
122 | - 'eval' => 'date', |
|
123 | - 'max' => '50' |
|
124 | - ), |
|
125 | - ), |
|
126 | - 'starttime' => array( |
|
127 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:starttime', |
|
128 | - 'config' => array( |
|
129 | - 'type' => 'input', |
|
130 | - 'size' => '13', |
|
131 | - 'max' => '20', |
|
132 | - 'eval' => 'datetime', |
|
133 | - 'default' => '0' |
|
134 | - ), |
|
135 | - ), |
|
136 | - ), |
|
137 | - 'grid' => array( |
|
138 | - 'excluded_fields' => 'middle_name, alternative_name', |
|
139 | - 'columns' => array( |
|
140 | - 'username' => array( |
|
141 | - 'visible' => true, |
|
142 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:username', |
|
143 | - 'editable' => true, |
|
144 | - ), |
|
145 | - 'name' => array( |
|
146 | - 'visible' => true, |
|
147 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:name', |
|
148 | - 'editable' => true, |
|
149 | - ), |
|
150 | - 'usergroup' => array( |
|
151 | - 'visible' => true, |
|
152 | - 'renderers' => array( |
|
153 | - 'Fab\Vidi\Grid\RelationEditRenderer', |
|
154 | - 'Fab\Vidi\Grid\RelationRenderer', |
|
155 | - ), |
|
156 | - 'editable' => true, |
|
157 | - 'sortable' => false, |
|
158 | - 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:usergroup', |
|
159 | - ), |
|
160 | - ), |
|
161 | - ), |
|
162 | - ); |
|
22 | + $GLOBALS['TCA']['tx_foo'] = array( |
|
23 | + 'ctrl' => array( |
|
24 | + 'label' => 'username', |
|
25 | + 'default_sortby' => 'ORDER BY username', |
|
26 | + 'tstamp' => 'tstamp', |
|
27 | + 'crdate' => 'crdate', |
|
28 | + 'cruser_id' => 'cruser_id', |
|
29 | + 'title' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:tx_foo', |
|
30 | + 'delete' => 'deleted', |
|
31 | + 'enablecolumns' => array( |
|
32 | + 'disabled' => 'disable', |
|
33 | + 'starttime' => 'starttime', |
|
34 | + 'endtime' => 'endtime' |
|
35 | + ), |
|
36 | + 'typeicon_classes' => array( |
|
37 | + 'default' => 'status-user-frontend' |
|
38 | + ), |
|
39 | + 'searchFields' => 'username,name,first_name,last_name' |
|
40 | + ), |
|
41 | + 'columns' => array( |
|
42 | + 'username' => array( |
|
43 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:username', |
|
44 | + 'config' => array( |
|
45 | + 'type' => 'input', |
|
46 | + 'size' => '20', |
|
47 | + 'max' => '255', |
|
48 | + 'eval' => 'nospace,lower,uniqueInPid,required' |
|
49 | + ), |
|
50 | + ), |
|
51 | + 'password' => array( |
|
52 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:password', |
|
53 | + 'config' => array( |
|
54 | + 'type' => 'input', |
|
55 | + 'size' => '10', |
|
56 | + 'max' => '40', |
|
57 | + 'eval' => 'nospace,required,password' |
|
58 | + ), |
|
59 | + ), |
|
60 | + 'usergroup' => array( |
|
61 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:usergroup', |
|
62 | + 'config' => array( |
|
63 | + 'type' => 'select', |
|
64 | + 'renderType' => 'selectMultipleSideBySide', |
|
65 | + 'foreign_table' => 'fe_groups', |
|
66 | + 'foreign_table_where' => 'ORDER BY fe_groups.title', |
|
67 | + 'size' => '6', |
|
68 | + 'minitems' => '1', |
|
69 | + 'maxitems' => '50' |
|
70 | + ), |
|
71 | + ), |
|
72 | + 'name' => array( |
|
73 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:name', |
|
74 | + 'config' => array( |
|
75 | + 'type' => 'input', |
|
76 | + 'size' => '40', |
|
77 | + 'eval' => 'trim', |
|
78 | + 'max' => '80' |
|
79 | + ), |
|
80 | + ), |
|
81 | + 'first_name' => array( |
|
82 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:first_name', |
|
83 | + 'config' => array( |
|
84 | + 'type' => 'input', |
|
85 | + 'size' => '25', |
|
86 | + 'eval' => 'trim', |
|
87 | + 'max' => '50' |
|
88 | + ), |
|
89 | + ), |
|
90 | + 'last_name' => array( |
|
91 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:last_name', |
|
92 | + 'config' => array( |
|
93 | + 'type' => 'input', |
|
94 | + 'size' => '25', |
|
95 | + 'eval' => 'trim', |
|
96 | + 'max' => '50' |
|
97 | + ), |
|
98 | + ), |
|
99 | + 'middle_name' => array( |
|
100 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:middle_name', |
|
101 | + 'config' => array( |
|
102 | + 'type' => 'input', |
|
103 | + 'size' => '25', |
|
104 | + 'eval' => 'trim', |
|
105 | + 'max' => '50' |
|
106 | + ), |
|
107 | + ), |
|
108 | + 'alternative_name' => array( |
|
109 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:alternative_name', |
|
110 | + 'config' => array( |
|
111 | + 'type' => 'input', |
|
112 | + 'size' => '25', |
|
113 | + 'eval' => 'trim', |
|
114 | + 'max' => '50' |
|
115 | + ), |
|
116 | + ), |
|
117 | + 'birthday' => array( |
|
118 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:birthday', |
|
119 | + 'config' => array( |
|
120 | + 'type' => 'input', |
|
121 | + 'size' => '25', |
|
122 | + 'eval' => 'date', |
|
123 | + 'max' => '50' |
|
124 | + ), |
|
125 | + ), |
|
126 | + 'starttime' => array( |
|
127 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:starttime', |
|
128 | + 'config' => array( |
|
129 | + 'type' => 'input', |
|
130 | + 'size' => '13', |
|
131 | + 'max' => '20', |
|
132 | + 'eval' => 'datetime', |
|
133 | + 'default' => '0' |
|
134 | + ), |
|
135 | + ), |
|
136 | + ), |
|
137 | + 'grid' => array( |
|
138 | + 'excluded_fields' => 'middle_name, alternative_name', |
|
139 | + 'columns' => array( |
|
140 | + 'username' => array( |
|
141 | + 'visible' => true, |
|
142 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:username', |
|
143 | + 'editable' => true, |
|
144 | + ), |
|
145 | + 'name' => array( |
|
146 | + 'visible' => true, |
|
147 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:name', |
|
148 | + 'editable' => true, |
|
149 | + ), |
|
150 | + 'usergroup' => array( |
|
151 | + 'visible' => true, |
|
152 | + 'renderers' => array( |
|
153 | + 'Fab\Vidi\Grid\RelationEditRenderer', |
|
154 | + 'Fab\Vidi\Grid\RelationRenderer', |
|
155 | + ), |
|
156 | + 'editable' => true, |
|
157 | + 'sortable' => false, |
|
158 | + 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:usergroup', |
|
159 | + ), |
|
160 | + ), |
|
161 | + ), |
|
162 | + ); |
|
163 | 163 | |
164 | - /* |
|
164 | + /* |
|
165 | 165 | ################# |
166 | 166 | # opposite many |
167 | 167 | # one-to-many |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | ); |
247 | 247 | |
248 | 248 | */ |
249 | - } |
|
249 | + } |
|
250 | 250 | |
251 | - public function tearDown() |
|
252 | - { |
|
253 | - unset($this->fixture, $GLOBALS['TCA']); |
|
254 | - } |
|
251 | + public function tearDown() |
|
252 | + { |
|
253 | + unset($this->fixture, $GLOBALS['TCA']); |
|
254 | + } |
|
255 | 255 | } |
@@ -22,94 +22,94 @@ |
||
22 | 22 | */ |
23 | 23 | class FieldServiceTest extends AbstractServiceTest |
24 | 24 | { |
25 | - /** |
|
26 | - * @var TableService |
|
27 | - */ |
|
28 | - private $fixture; |
|
25 | + /** |
|
26 | + * @var TableService |
|
27 | + */ |
|
28 | + private $fixture; |
|
29 | 29 | |
30 | - public function setUp() |
|
31 | - { |
|
32 | - parent::setUp(); |
|
33 | - $this->fixture = new TableService('tx_foo'); |
|
34 | - } |
|
30 | + public function setUp() |
|
31 | + { |
|
32 | + parent::setUp(); |
|
33 | + $this->fixture = new TableService('tx_foo'); |
|
34 | + } |
|
35 | 35 | |
36 | - public function tearDown() |
|
37 | - { |
|
38 | - unset($this->fixture); |
|
39 | - } |
|
36 | + public function tearDown() |
|
37 | + { |
|
38 | + unset($this->fixture); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @test |
|
43 | - */ |
|
44 | - public function fieldsIncludesATitleFieldInTableSysFile() |
|
45 | - { |
|
46 | - $actual = $this->fixture->getFields(); |
|
47 | - $this->assertTrue(is_array($actual)); |
|
48 | - $this->assertContains('username', $actual); |
|
49 | - } |
|
41 | + /** |
|
42 | + * @test |
|
43 | + */ |
|
44 | + public function fieldsIncludesATitleFieldInTableSysFile() |
|
45 | + { |
|
46 | + $actual = $this->fixture->getFields(); |
|
47 | + $this->assertTrue(is_array($actual)); |
|
48 | + $this->assertContains('username', $actual); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @test |
|
53 | - */ |
|
54 | - public function fieldTypeReturnsInputForFieldTitleInTableSysFile() |
|
55 | - { |
|
56 | - $field = $this->fixture->field('username'); |
|
57 | - $actual = $field->getType(); |
|
58 | - $this->assertEquals('text', $actual); |
|
59 | - } |
|
51 | + /** |
|
52 | + * @test |
|
53 | + */ |
|
54 | + public function fieldTypeReturnsInputForFieldTitleInTableSysFile() |
|
55 | + { |
|
56 | + $field = $this->fixture->field('username'); |
|
57 | + $actual = $field->getType(); |
|
58 | + $this->assertEquals('text', $actual); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @test |
|
63 | - */ |
|
64 | - public function fieldNameMustBeRequiredByDefault() |
|
65 | - { |
|
66 | - $field = $this->fixture->field('username'); |
|
67 | - $this->assertTrue($field->isRequired()); |
|
68 | - } |
|
61 | + /** |
|
62 | + * @test |
|
63 | + */ |
|
64 | + public function fieldNameMustBeRequiredByDefault() |
|
65 | + { |
|
66 | + $field = $this->fixture->field('username'); |
|
67 | + $this->assertTrue($field->isRequired()); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @test |
|
72 | - */ |
|
73 | - public function fieldFirstNameMustNotBeRequiredByDefault() |
|
74 | - { |
|
75 | - $field = $this->fixture->field('first_name'); |
|
76 | - $this->assertFalse($field->isRequired()); |
|
77 | - } |
|
70 | + /** |
|
71 | + * @test |
|
72 | + */ |
|
73 | + public function fieldFirstNameMustNotBeRequiredByDefault() |
|
74 | + { |
|
75 | + $field = $this->fixture->field('first_name'); |
|
76 | + $this->assertFalse($field->isRequired()); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * @test |
|
81 | - */ |
|
82 | - public function getTypeForFieldStarTimeReturnsDataTime() |
|
83 | - { |
|
84 | - $fieldType = $this->fixture->field('starttime')->getType(); |
|
85 | - $this->assertEquals(FieldType::DATETIME, $fieldType); |
|
86 | - } |
|
79 | + /** |
|
80 | + * @test |
|
81 | + */ |
|
82 | + public function getTypeForFieldStarTimeReturnsDataTime() |
|
83 | + { |
|
84 | + $fieldType = $this->fixture->field('starttime')->getType(); |
|
85 | + $this->assertEquals(FieldType::DATETIME, $fieldType); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @test |
|
90 | - * @dataProvider fieldProvider |
|
91 | - */ |
|
92 | - public function hasRelationReturnsFalseForFieldName($fieldName, $hasRelation, $hasRelationOneToMany, $hasRelationManyToMany) |
|
93 | - { |
|
94 | - $field = $this->fixture->field($fieldName); |
|
95 | - $this->assertEquals($hasRelation, $field->hasRelation()); |
|
96 | - $this->assertNotEquals($hasRelation, $field->hasNoRelation()); |
|
97 | - $this->assertEquals($hasRelationOneToMany, $field->hasRelationOneToMany()); |
|
98 | - $this->assertEquals($hasRelationOneToMany, $field->hasRelationManyToOne()); |
|
99 | - $this->assertEquals($hasRelationManyToMany, $field->hasRelationManyToMany()); |
|
100 | - $this->assertEquals($hasRelationOneToMany, $field->hasRelationOneToOne()); |
|
101 | - } |
|
88 | + /** |
|
89 | + * @test |
|
90 | + * @dataProvider fieldProvider |
|
91 | + */ |
|
92 | + public function hasRelationReturnsFalseForFieldName($fieldName, $hasRelation, $hasRelationOneToMany, $hasRelationManyToMany) |
|
93 | + { |
|
94 | + $field = $this->fixture->field($fieldName); |
|
95 | + $this->assertEquals($hasRelation, $field->hasRelation()); |
|
96 | + $this->assertNotEquals($hasRelation, $field->hasNoRelation()); |
|
97 | + $this->assertEquals($hasRelationOneToMany, $field->hasRelationOneToMany()); |
|
98 | + $this->assertEquals($hasRelationOneToMany, $field->hasRelationManyToOne()); |
|
99 | + $this->assertEquals($hasRelationManyToMany, $field->hasRelationManyToMany()); |
|
100 | + $this->assertEquals($hasRelationOneToMany, $field->hasRelationOneToOne()); |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Provider |
|
105 | - */ |
|
106 | - public function fieldProvider() |
|
107 | - { |
|
108 | - return array( |
|
109 | - array('username', false, false, false, false, false), |
|
110 | - #array('usergroup', true, false, true), |
|
111 | - ); |
|
112 | - } |
|
103 | + /** |
|
104 | + * Provider |
|
105 | + */ |
|
106 | + public function fieldProvider() |
|
107 | + { |
|
108 | + return array( |
|
109 | + array('username', false, false, false, false, false), |
|
110 | + #array('usergroup', true, false, true), |
|
111 | + ); |
|
112 | + } |
|
113 | 113 | |
114 | - // @todo implement Unit Tests for relation. Below example of TCA... |
|
114 | + // @todo implement Unit Tests for relation. Below example of TCA... |
|
115 | 115 | } |
@@ -5,12 +5,12 @@ discard block |
||
5 | 5 | use TYPO3\CMS\Core\Utility\ArrayUtility; |
6 | 6 | |
7 | 7 | if (!defined('TYPO3')) { |
8 | - die('Access denied.'); |
|
8 | + die('Access denied.'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | $tca = [ |
12 | - 'grid' => [ |
|
13 | - 'excluded_fields' => 'image, imagewidth, imageorient, imagecols, imageborder, image_noRows, image_effects, image_compression, tx_impexp_origuid, image_zoom, |
|
12 | + 'grid' => [ |
|
13 | + 'excluded_fields' => 'image, imagewidth, imageorient, imagecols, imageborder, image_noRows, image_effects, image_compression, tx_impexp_origuid, image_zoom, |
|
14 | 14 | spaceAfter, spaceBefore, |
15 | 15 | uploads_description, uploads_type, |
16 | 16 | media, assets, table_caption, table_delimiter, table_enclosure, table_header_position, table_tfoot, table_bgColor, table_border, table_cellpadding, table_cellspacing, |
@@ -20,39 +20,39 @@ discard block |
||
20 | 20 | target, linkToTop, menu_type, list_type, select_key, |
21 | 21 | file_collections, filelink_size, filelink_sorting, |
22 | 22 | external_media_ratio, external_media_source', |
23 | - 'columns' => [ |
|
24 | - '__checkbox' => [ |
|
25 | - 'renderer' => CheckBoxRenderer::class, |
|
26 | - ], |
|
27 | - 'uid' => [ |
|
28 | - 'visible' => false, |
|
29 | - 'label' => 'Id', |
|
30 | - 'width' => '5px', |
|
31 | - ], |
|
32 | - 'header' => [ |
|
33 | - 'editable' => true, |
|
34 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tt_content.xlf:header', |
|
35 | - ], |
|
36 | - 'tstamp' => [ |
|
37 | - 'visible' => false, |
|
38 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
39 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
40 | - ], |
|
41 | - 'crdate' => [ |
|
42 | - 'visible' => false, |
|
43 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
44 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
45 | - ], |
|
46 | - 'hidden' => [ |
|
47 | - 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
48 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
49 | - 'width' => '3%', |
|
50 | - ], |
|
51 | - '__buttons' => [ |
|
52 | - 'renderer' => ButtonGroupRenderer::class, |
|
53 | - ], |
|
54 | - ], |
|
55 | - ], |
|
23 | + 'columns' => [ |
|
24 | + '__checkbox' => [ |
|
25 | + 'renderer' => CheckBoxRenderer::class, |
|
26 | + ], |
|
27 | + 'uid' => [ |
|
28 | + 'visible' => false, |
|
29 | + 'label' => 'Id', |
|
30 | + 'width' => '5px', |
|
31 | + ], |
|
32 | + 'header' => [ |
|
33 | + 'editable' => true, |
|
34 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tt_content.xlf:header', |
|
35 | + ], |
|
36 | + 'tstamp' => [ |
|
37 | + 'visible' => false, |
|
38 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
39 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
40 | + ], |
|
41 | + 'crdate' => [ |
|
42 | + 'visible' => false, |
|
43 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
44 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
45 | + ], |
|
46 | + 'hidden' => [ |
|
47 | + 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
48 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
49 | + 'width' => '3%', |
|
50 | + ], |
|
51 | + '__buttons' => [ |
|
52 | + 'renderer' => ButtonGroupRenderer::class, |
|
53 | + ], |
|
54 | + ], |
|
55 | + ], |
|
56 | 56 | ]; |
57 | 57 | |
58 | 58 | ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['tt_content'], $tca); |
@@ -7,113 +7,113 @@ |
||
7 | 7 | use TYPO3\CMS\Core\Utility\ArrayUtility; |
8 | 8 | |
9 | 9 | if (!defined('TYPO3')) { |
10 | - die('Access denied.'); |
|
10 | + die('Access denied.'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | $tca = [ |
14 | - 'ctrl' => [ |
|
15 | - // By default "searchFields" has many fields which has a performance cost when dealing with large data-set. |
|
16 | - // Override search field for performance reason. |
|
17 | - // To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup', |
|
18 | - 'searchFields' => 'username, first_name, last_name, usergroup', |
|
19 | - ], |
|
20 | - 'vidi' => [ |
|
21 | - // Special case when the field name does not follow the conventions. |
|
22 | - // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
23 | - 'mappings' => [ |
|
24 | - 'lockToDomain' => 'lockToDomain', |
|
25 | - 'TSconfig' => 'tsConfig', |
|
26 | - 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
27 | - 'felogin_forgotHash' => 'feLoginForgotHash', |
|
28 | - ], |
|
29 | - ], |
|
30 | - 'grid' => [ |
|
31 | - 'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token, image', |
|
32 | - 'export' => [ |
|
33 | - 'include_files' => false, |
|
34 | - ], |
|
35 | - 'facets' => [ |
|
36 | - 'uid', |
|
37 | - 'username', |
|
38 | - 'name', |
|
39 | - 'first_name', |
|
40 | - 'last_name', |
|
41 | - 'address', |
|
42 | - 'telephone', |
|
43 | - 'fax', |
|
44 | - 'email', |
|
45 | - 'title', |
|
46 | - 'zip', |
|
47 | - 'city', |
|
48 | - 'country', |
|
49 | - 'company', |
|
50 | - 'usergroup', |
|
51 | - StandardFacet::class => [ |
|
52 | - 'name' => 'disable', |
|
53 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
54 | - 'suggestions' => [ |
|
55 | - '0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0', |
|
56 | - '1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1' |
|
57 | - ] |
|
58 | - ], |
|
59 | - PageFacet::class => [ |
|
60 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
61 | - ], |
|
62 | - ], |
|
63 | - 'columns' => [ |
|
64 | - '__checkbox' => [ |
|
65 | - 'renderer' => CheckBoxRenderer::class, |
|
66 | - ], |
|
67 | - 'uid' => [ |
|
68 | - 'visible' => false, |
|
69 | - 'label' => 'Id', |
|
70 | - 'width' => '5px', |
|
71 | - ], |
|
72 | - 'username' => [ |
|
73 | - 'visible' => true, |
|
74 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username', |
|
75 | - 'editable' => true, |
|
76 | - ], |
|
77 | - 'name' => [ |
|
78 | - 'visible' => true, |
|
79 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name', |
|
80 | - 'editable' => true, |
|
81 | - ], |
|
82 | - 'email' => [ |
|
83 | - 'visible' => true, |
|
84 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email', |
|
85 | - 'editable' => true, |
|
86 | - ], |
|
87 | - 'usergroup' => [ |
|
88 | - 'visible' => true, |
|
89 | - 'renderers' => [ |
|
90 | - 'Fab\Vidi\Grid\RelationEditRenderer', |
|
91 | - 'Fab\Vidi\Grid\RelationRenderer', |
|
92 | - ], |
|
93 | - 'editable' => true, |
|
94 | - 'sortable' => false, |
|
95 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup', |
|
96 | - ], |
|
97 | - 'tstamp' => [ |
|
98 | - 'visible' => false, |
|
99 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
100 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
101 | - ], |
|
102 | - 'crdate' => [ |
|
103 | - 'visible' => false, |
|
104 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
105 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
106 | - ], |
|
107 | - 'disable' => [ |
|
108 | - 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
109 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
110 | - 'width' => '3%', |
|
111 | - ], |
|
112 | - '__buttons' => [ |
|
113 | - 'renderer' => ButtonGroupRenderer::class, |
|
114 | - ], |
|
115 | - ], |
|
116 | - ], |
|
14 | + 'ctrl' => [ |
|
15 | + // By default "searchFields" has many fields which has a performance cost when dealing with large data-set. |
|
16 | + // Override search field for performance reason. |
|
17 | + // To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup', |
|
18 | + 'searchFields' => 'username, first_name, last_name, usergroup', |
|
19 | + ], |
|
20 | + 'vidi' => [ |
|
21 | + // Special case when the field name does not follow the conventions. |
|
22 | + // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
23 | + 'mappings' => [ |
|
24 | + 'lockToDomain' => 'lockToDomain', |
|
25 | + 'TSconfig' => 'tsConfig', |
|
26 | + 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
27 | + 'felogin_forgotHash' => 'feLoginForgotHash', |
|
28 | + ], |
|
29 | + ], |
|
30 | + 'grid' => [ |
|
31 | + 'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token, image', |
|
32 | + 'export' => [ |
|
33 | + 'include_files' => false, |
|
34 | + ], |
|
35 | + 'facets' => [ |
|
36 | + 'uid', |
|
37 | + 'username', |
|
38 | + 'name', |
|
39 | + 'first_name', |
|
40 | + 'last_name', |
|
41 | + 'address', |
|
42 | + 'telephone', |
|
43 | + 'fax', |
|
44 | + 'email', |
|
45 | + 'title', |
|
46 | + 'zip', |
|
47 | + 'city', |
|
48 | + 'country', |
|
49 | + 'company', |
|
50 | + 'usergroup', |
|
51 | + StandardFacet::class => [ |
|
52 | + 'name' => 'disable', |
|
53 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
54 | + 'suggestions' => [ |
|
55 | + '0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0', |
|
56 | + '1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1' |
|
57 | + ] |
|
58 | + ], |
|
59 | + PageFacet::class => [ |
|
60 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
61 | + ], |
|
62 | + ], |
|
63 | + 'columns' => [ |
|
64 | + '__checkbox' => [ |
|
65 | + 'renderer' => CheckBoxRenderer::class, |
|
66 | + ], |
|
67 | + 'uid' => [ |
|
68 | + 'visible' => false, |
|
69 | + 'label' => 'Id', |
|
70 | + 'width' => '5px', |
|
71 | + ], |
|
72 | + 'username' => [ |
|
73 | + 'visible' => true, |
|
74 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username', |
|
75 | + 'editable' => true, |
|
76 | + ], |
|
77 | + 'name' => [ |
|
78 | + 'visible' => true, |
|
79 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name', |
|
80 | + 'editable' => true, |
|
81 | + ], |
|
82 | + 'email' => [ |
|
83 | + 'visible' => true, |
|
84 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email', |
|
85 | + 'editable' => true, |
|
86 | + ], |
|
87 | + 'usergroup' => [ |
|
88 | + 'visible' => true, |
|
89 | + 'renderers' => [ |
|
90 | + 'Fab\Vidi\Grid\RelationEditRenderer', |
|
91 | + 'Fab\Vidi\Grid\RelationRenderer', |
|
92 | + ], |
|
93 | + 'editable' => true, |
|
94 | + 'sortable' => false, |
|
95 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup', |
|
96 | + ], |
|
97 | + 'tstamp' => [ |
|
98 | + 'visible' => false, |
|
99 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
100 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
101 | + ], |
|
102 | + 'crdate' => [ |
|
103 | + 'visible' => false, |
|
104 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
105 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
106 | + ], |
|
107 | + 'disable' => [ |
|
108 | + 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
109 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
110 | + 'width' => '3%', |
|
111 | + ], |
|
112 | + '__buttons' => [ |
|
113 | + 'renderer' => ButtonGroupRenderer::class, |
|
114 | + ], |
|
115 | + ], |
|
116 | + ], |
|
117 | 117 | ]; |
118 | 118 | |
119 | 119 | ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_users'], $tca); |
@@ -6,62 +6,62 @@ |
||
6 | 6 | use TYPO3\CMS\Core\Utility\ArrayUtility; |
7 | 7 | |
8 | 8 | if (!defined('TYPO3')) { |
9 | - die('Access denied.'); |
|
9 | + die('Access denied.'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | $tca = [ |
13 | - 'vidi' => [ |
|
14 | - // Special case when the field name does not follow the conventions. |
|
15 | - // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
16 | - 'mappings' => [ |
|
17 | - 'lockToDomain' => 'lockToDomain', |
|
18 | - 'TSconfig' => 'tsConfig', |
|
19 | - 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
20 | - ], |
|
21 | - ], |
|
22 | - 'grid' => [ |
|
23 | - 'facets' => [ |
|
24 | - 'uid', |
|
25 | - 'title', |
|
26 | - 'description', |
|
27 | - PageFacet::class => [ |
|
28 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
29 | - ] |
|
30 | - ], |
|
31 | - 'columns' => [ |
|
32 | - '__checkbox' => [ |
|
33 | - 'renderer' => CheckBoxRenderer::class, |
|
34 | - ], |
|
35 | - 'uid' => [ |
|
36 | - 'visible' => false, |
|
37 | - 'label' => 'Id', |
|
38 | - 'width' => '5px', |
|
39 | - ], |
|
40 | - 'title' => [ |
|
41 | - 'visible' => true, |
|
42 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf:title', |
|
43 | - 'editable' => true, |
|
44 | - ], |
|
45 | - 'tstamp' => [ |
|
46 | - 'visible' => false, |
|
47 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
48 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
49 | - ], |
|
50 | - 'crdate' => [ |
|
51 | - 'visible' => false, |
|
52 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
53 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
54 | - ], |
|
55 | - 'hidden' => [ |
|
56 | - 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
57 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation', |
|
58 | - 'width' => '3%', |
|
59 | - ], |
|
60 | - '__buttons' => [ |
|
61 | - 'renderer' => ButtonGroupRenderer::class, |
|
62 | - ], |
|
63 | - ] |
|
64 | - ] |
|
13 | + 'vidi' => [ |
|
14 | + // Special case when the field name does not follow the conventions. |
|
15 | + // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
16 | + 'mappings' => [ |
|
17 | + 'lockToDomain' => 'lockToDomain', |
|
18 | + 'TSconfig' => 'tsConfig', |
|
19 | + 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
20 | + ], |
|
21 | + ], |
|
22 | + 'grid' => [ |
|
23 | + 'facets' => [ |
|
24 | + 'uid', |
|
25 | + 'title', |
|
26 | + 'description', |
|
27 | + PageFacet::class => [ |
|
28 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
29 | + ] |
|
30 | + ], |
|
31 | + 'columns' => [ |
|
32 | + '__checkbox' => [ |
|
33 | + 'renderer' => CheckBoxRenderer::class, |
|
34 | + ], |
|
35 | + 'uid' => [ |
|
36 | + 'visible' => false, |
|
37 | + 'label' => 'Id', |
|
38 | + 'width' => '5px', |
|
39 | + ], |
|
40 | + 'title' => [ |
|
41 | + 'visible' => true, |
|
42 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf:title', |
|
43 | + 'editable' => true, |
|
44 | + ], |
|
45 | + 'tstamp' => [ |
|
46 | + 'visible' => false, |
|
47 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
48 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
49 | + ], |
|
50 | + 'crdate' => [ |
|
51 | + 'visible' => false, |
|
52 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
53 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
54 | + ], |
|
55 | + 'hidden' => [ |
|
56 | + 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
57 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation', |
|
58 | + 'width' => '3%', |
|
59 | + ], |
|
60 | + '__buttons' => [ |
|
61 | + 'renderer' => ButtonGroupRenderer::class, |
|
62 | + ], |
|
63 | + ] |
|
64 | + ] |
|
65 | 65 | ]; |
66 | 66 | |
67 | 67 | ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_groups'], $tca); |
@@ -1,92 +1,92 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (!defined('TYPO3')) { |
4 | - die('Access denied.'); |
|
4 | + die('Access denied.'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | return [ |
8 | - 'ctrl' => [ |
|
9 | - 'title' => 'LLL:EXT:phpdisplay/Resources/Private/Language/locallang_db.xml:tx_phpdisplay_displays', |
|
10 | - 'label' => 'name', |
|
11 | - 'tstamp' => 'tstamp', |
|
12 | - 'crdate' => 'crdate', |
|
13 | - 'cruser_id' => 'cruser_id', |
|
14 | - 'hideTable' => true, |
|
15 | - 'delete' => 'deleted', |
|
16 | - 'enablecolumns' => [ |
|
17 | - 'disabled' => 'hidden', |
|
18 | - ], |
|
19 | - 'searchFields' => 'type,name,data_type', |
|
20 | - 'typeicon_classes' => [ |
|
21 | - 'default' => 'extensions-vidi-selection', |
|
22 | - ], |
|
23 | - ], |
|
24 | - 'types' => [ |
|
25 | - '1' => ['showitem' => 'hidden,--palette--;;1,type,name,data_type,query'], |
|
26 | - ], |
|
27 | - 'palettes' => [ |
|
28 | - '1' => ['showitem' => ''], |
|
29 | - ], |
|
30 | - 'columns' => [ |
|
8 | + 'ctrl' => [ |
|
9 | + 'title' => 'LLL:EXT:phpdisplay/Resources/Private/Language/locallang_db.xml:tx_phpdisplay_displays', |
|
10 | + 'label' => 'name', |
|
11 | + 'tstamp' => 'tstamp', |
|
12 | + 'crdate' => 'crdate', |
|
13 | + 'cruser_id' => 'cruser_id', |
|
14 | + 'hideTable' => true, |
|
15 | + 'delete' => 'deleted', |
|
16 | + 'enablecolumns' => [ |
|
17 | + 'disabled' => 'hidden', |
|
18 | + ], |
|
19 | + 'searchFields' => 'type,name,data_type', |
|
20 | + 'typeicon_classes' => [ |
|
21 | + 'default' => 'extensions-vidi-selection', |
|
22 | + ], |
|
23 | + ], |
|
24 | + 'types' => [ |
|
25 | + '1' => ['showitem' => 'hidden,--palette--;;1,type,name,data_type,query'], |
|
26 | + ], |
|
27 | + 'palettes' => [ |
|
28 | + '1' => ['showitem' => ''], |
|
29 | + ], |
|
30 | + 'columns' => [ |
|
31 | 31 | |
32 | - 'hidden' => [ |
|
33 | - 'exclude' => 1, |
|
34 | - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', |
|
35 | - 'config' => [ |
|
36 | - 'type' => 'check', |
|
37 | - ], |
|
38 | - ], |
|
39 | - 'visibility' => [ |
|
40 | - 'exclude' => 0, |
|
41 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility', |
|
42 | - 'config' => [ |
|
43 | - 'type' => 'select', |
|
44 | - 'renderType' => 'selectSingle', |
|
45 | - 'items' => [ |
|
46 | - ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.everyone', 0], |
|
47 | - ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.private', 1], |
|
48 | - ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.admin_only', 2], |
|
49 | - ], |
|
50 | - 'size' => 1, |
|
51 | - 'maxitems' => 1, |
|
52 | - 'minitems' => 1, |
|
53 | - ], |
|
54 | - ], |
|
55 | - 'name' => [ |
|
56 | - 'exclude' => 0, |
|
57 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:name', |
|
58 | - 'config' => [ |
|
59 | - 'type' => 'input', |
|
60 | - 'size' => 30, |
|
61 | - 'eval' => 'trim,required' |
|
62 | - ], |
|
63 | - ], |
|
64 | - 'data_type' => [ |
|
65 | - 'exclude' => 0, |
|
66 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:data_type', |
|
67 | - 'config' => [ |
|
68 | - 'type' => 'input', |
|
69 | - 'size' => 30, |
|
70 | - 'eval' => 'trim,required' |
|
71 | - ], |
|
72 | - ], |
|
73 | - 'query' => [ |
|
74 | - 'exclude' => 0, |
|
75 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:query', |
|
76 | - 'config' => [ |
|
77 | - 'type' => 'text', |
|
78 | - 'rows' => 5, |
|
79 | - 'cols' => 5, |
|
80 | - ], |
|
81 | - ], |
|
82 | - 'speaking_query' => [ |
|
83 | - 'exclude' => 0, |
|
84 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:speaking_query', |
|
85 | - 'config' => [ |
|
86 | - 'type' => 'text', |
|
87 | - 'rows' => 5, |
|
88 | - 'cols' => 5, |
|
89 | - ], |
|
90 | - ], |
|
91 | - ], |
|
32 | + 'hidden' => [ |
|
33 | + 'exclude' => 1, |
|
34 | + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', |
|
35 | + 'config' => [ |
|
36 | + 'type' => 'check', |
|
37 | + ], |
|
38 | + ], |
|
39 | + 'visibility' => [ |
|
40 | + 'exclude' => 0, |
|
41 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility', |
|
42 | + 'config' => [ |
|
43 | + 'type' => 'select', |
|
44 | + 'renderType' => 'selectSingle', |
|
45 | + 'items' => [ |
|
46 | + ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.everyone', 0], |
|
47 | + ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.private', 1], |
|
48 | + ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.admin_only', 2], |
|
49 | + ], |
|
50 | + 'size' => 1, |
|
51 | + 'maxitems' => 1, |
|
52 | + 'minitems' => 1, |
|
53 | + ], |
|
54 | + ], |
|
55 | + 'name' => [ |
|
56 | + 'exclude' => 0, |
|
57 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:name', |
|
58 | + 'config' => [ |
|
59 | + 'type' => 'input', |
|
60 | + 'size' => 30, |
|
61 | + 'eval' => 'trim,required' |
|
62 | + ], |
|
63 | + ], |
|
64 | + 'data_type' => [ |
|
65 | + 'exclude' => 0, |
|
66 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:data_type', |
|
67 | + 'config' => [ |
|
68 | + 'type' => 'input', |
|
69 | + 'size' => 30, |
|
70 | + 'eval' => 'trim,required' |
|
71 | + ], |
|
72 | + ], |
|
73 | + 'query' => [ |
|
74 | + 'exclude' => 0, |
|
75 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:query', |
|
76 | + 'config' => [ |
|
77 | + 'type' => 'text', |
|
78 | + 'rows' => 5, |
|
79 | + 'cols' => 5, |
|
80 | + ], |
|
81 | + ], |
|
82 | + 'speaking_query' => [ |
|
83 | + 'exclude' => 0, |
|
84 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:speaking_query', |
|
85 | + 'config' => [ |
|
86 | + 'type' => 'text', |
|
87 | + 'rows' => 5, |
|
88 | + 'cols' => 5, |
|
89 | + ], |
|
90 | + ], |
|
91 | + ], |
|
92 | 92 | ]; |
@@ -18,166 +18,166 @@ |
||
18 | 18 | defined('TYPO3') or die(); |
19 | 19 | |
20 | 20 | call_user_func(function () { |
21 | - // Check from Vidi configuration what default module should be loaded. |
|
22 | - // Make sure the class exists to avoid a Runtime Error |
|
23 | - |
|
24 | - // Add content main module before 'user' |
|
25 | - if (!isset($GLOBALS['TBE_MODULES']['content'])) { |
|
26 | - // Position module "content" after module "user" manually. No API is available for that, it seems... |
|
27 | - $modules = []; |
|
28 | - foreach ($GLOBALS['TBE_MODULES'] as $key => $val) { |
|
29 | - if ($key === 'user') { |
|
30 | - $modules['content'] = ''; |
|
31 | - } |
|
32 | - $modules[$key] = $val; |
|
33 | - } |
|
34 | - $GLOBALS['TBE_MODULES'] = $modules; |
|
35 | - |
|
36 | - // Register "data management" module. |
|
37 | - ExtensionManagementUtility::addModule( |
|
38 | - 'content', |
|
39 | - '', |
|
40 | - '', |
|
41 | - '', |
|
42 | - [ |
|
43 | - 'name' => 'content', |
|
44 | - 'access' => 'user,group', |
|
45 | - 'labels' => [ |
|
46 | - 'll_ref' => 'LLL:EXT:vidi/Resources/Private/Language/content_module.xlf', |
|
47 | - ], |
|
48 | - ] |
|
49 | - ); |
|
50 | - } |
|
51 | - |
|
52 | - $configuration = GeneralUtility::makeInstance( |
|
53 | - ExtensionConfiguration::class |
|
54 | - )->get('vidi'); |
|
55 | - |
|
56 | - $pids = GeneralUtility::trimExplode(',', $configuration['default_pid'], true); |
|
57 | - $defaultPid = array_shift($pids); |
|
58 | - $defaultPids = []; |
|
59 | - foreach ($pids as $dataTypeAndPid) { |
|
60 | - $parts = GeneralUtility::trimExplode(':', $dataTypeAndPid); |
|
61 | - if (count($parts) === 2) { |
|
62 | - $defaultPids[$parts[0]] = $parts[1]; |
|
63 | - } |
|
64 | - } |
|
65 | - |
|
66 | - // Loop around the data types and register them to be displayed within a BE module. |
|
67 | - if ($configuration['data_types']) { |
|
68 | - $dataTypes = GeneralUtility::trimExplode(',', $configuration['data_types'], true); |
|
69 | - foreach ($dataTypes as $dataType) { |
|
70 | - /** @var ModuleLoader $moduleLoader */ |
|
71 | - $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class, $dataType); |
|
72 | - |
|
73 | - // Special case already defined in Vidi. |
|
74 | - if ($dataType === 'fe_users') { |
|
75 | - $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf'; |
|
76 | - $icon = 'EXT:vidi/Resources/Public/Images/fe_users.svg'; |
|
77 | - } elseif ($dataType === 'fe_groups') { |
|
78 | - $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf'; |
|
79 | - $icon = 'EXT:vidi/Resources/Public/Images/fe_groups.svg'; |
|
80 | - } else { |
|
81 | - /** @var LanguageFileGenerator $languageService */ |
|
82 | - $languageService = GeneralUtility::makeInstance(LanguageFileGenerator::class); |
|
83 | - $languageFile = $languageService->generate($dataType); |
|
84 | - $icon = ''; |
|
85 | - } |
|
86 | - |
|
87 | - $pid = $defaultPids[$dataType] ?? $defaultPid; |
|
88 | - |
|
89 | - /** @var ModuleLoader $moduleLoader */ |
|
90 | - $moduleLoader->setIcon($icon) |
|
91 | - ->setModuleLanguageFile($languageFile) |
|
92 | - ->setDefaultPid($pid) |
|
93 | - ->register(); |
|
94 | - } |
|
95 | - } |
|
96 | - |
|
97 | - // Possible Static TS loading |
|
98 | - if (true === isset($configuration['autoload_typoscript']) && false === (bool)$configuration['autoload_typoscript']) { |
|
99 | - ExtensionManagementUtility::addStaticFile('vidi', 'Configuration/TypoScript', 'Vidi: versatile and interactive display'); |
|
100 | - } |
|
101 | - |
|
102 | - // Register List2 only if beta feature is enabled. |
|
103 | - // @todo let see what we do with that |
|
104 | - #if ($configuration['activate_beta_features']) { |
|
105 | - # $labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module.xlf'; |
|
106 | - # |
|
107 | - # if (!$configuration['hide_module_list']) { |
|
108 | - # $labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module_transitional.xlf'; |
|
109 | - # } |
|
110 | - # |
|
111 | - # \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( |
|
112 | - # 'vidi', |
|
113 | - # 'web', // Make module a submodule of 'web' |
|
114 | - # 'm1', // Submodule key |
|
115 | - # 'after:list', // Position |
|
116 | - # array( |
|
117 | - # 'Content' => 'index, list, delete, update, edit, copy, move, localize, sort, copyClipboard, moveClipboard', |
|
118 | - # 'Tool' => 'welcome, work', |
|
119 | - # 'Facet' => 'autoSuggest, autoSuggests', |
|
120 | - # 'Selection' => 'edit, update, create, delete, list, show', |
|
121 | - # 'UserPreferences' => 'save', |
|
122 | - # 'Clipboard' => 'save, flush, show', |
|
123 | - # ), array( |
|
124 | - # 'access' => 'user,group', |
|
125 | - # 'icon' => 'EXT:vidi/Resources/Public/Images/list.png', |
|
126 | - # 'labels' => $labelFile, |
|
127 | - # ) |
|
128 | - # ); |
|
129 | - #} |
|
130 | - #if ($configuration['hide_module_list']) { |
|
131 | - # |
|
132 | - # // Default User TSConfig to be added in any case. |
|
133 | - # TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' |
|
134 | - # |
|
135 | - # # Hide the module in the BE. |
|
136 | - # options.hideModules.web := addToList(list) |
|
137 | - # '); |
|
138 | - #} |
|
139 | - |
|
140 | - /** @var $signalSlotDispatcher \TYPO3\CMS\Extbase\SignalSlot\Dispatcher */ |
|
141 | - $signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class); |
|
142 | - |
|
143 | - // Connect "processContentData" signal slot with the "ContentObjectProcessor". |
|
144 | - $signalSlotDispatcher->connect( |
|
145 | - 'Fab\Vidi\Controller\Backend\ContentController', |
|
146 | - 'processContentData', |
|
147 | - ContentObjectProcessor::class, |
|
148 | - 'processRelations', |
|
149 | - true |
|
150 | - ); |
|
151 | - |
|
152 | - // Connect "processContentData" signal with the "MarkerProcessor". |
|
153 | - $signalSlotDispatcher->connect( |
|
154 | - 'Fab\Vidi\Controller\Backend\ContentController', |
|
155 | - 'processContentData', |
|
156 | - MarkerProcessor::class, |
|
157 | - 'processMarkers', |
|
158 | - true |
|
159 | - ); |
|
160 | - |
|
161 | - // Register default Tools for Vidi. |
|
162 | - ToolRegistry::getInstance()->register('*', ModulePreferencesTool::class); |
|
163 | - ToolRegistry::getInstance()->register('*', RelationAnalyserTool::class); |
|
164 | - ToolRegistry::getInstance()->register('*', ConfiguredPidTool::class); |
|
165 | - |
|
166 | - // Add new sprite icon. |
|
167 | - $icons = [ |
|
168 | - 'go' => 'EXT:vidi/Resources/Public/Images/bullet_go.png', |
|
169 | - 'query' => 'EXT:vidi/Resources/Public/Images/drive_disk.png', |
|
170 | - ]; |
|
171 | - /** @var IconRegistry $iconRegistry */ |
|
172 | - $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); |
|
173 | - foreach ($icons as $key => $icon) { |
|
174 | - $iconRegistry->registerIcon( |
|
175 | - 'extensions-vidi-' . $key, |
|
176 | - BitmapIconProvider::class, |
|
177 | - [ |
|
178 | - 'source' => $icon |
|
179 | - ] |
|
180 | - ); |
|
181 | - } |
|
182 | - unset($iconRegistry); |
|
21 | + // Check from Vidi configuration what default module should be loaded. |
|
22 | + // Make sure the class exists to avoid a Runtime Error |
|
23 | + |
|
24 | + // Add content main module before 'user' |
|
25 | + if (!isset($GLOBALS['TBE_MODULES']['content'])) { |
|
26 | + // Position module "content" after module "user" manually. No API is available for that, it seems... |
|
27 | + $modules = []; |
|
28 | + foreach ($GLOBALS['TBE_MODULES'] as $key => $val) { |
|
29 | + if ($key === 'user') { |
|
30 | + $modules['content'] = ''; |
|
31 | + } |
|
32 | + $modules[$key] = $val; |
|
33 | + } |
|
34 | + $GLOBALS['TBE_MODULES'] = $modules; |
|
35 | + |
|
36 | + // Register "data management" module. |
|
37 | + ExtensionManagementUtility::addModule( |
|
38 | + 'content', |
|
39 | + '', |
|
40 | + '', |
|
41 | + '', |
|
42 | + [ |
|
43 | + 'name' => 'content', |
|
44 | + 'access' => 'user,group', |
|
45 | + 'labels' => [ |
|
46 | + 'll_ref' => 'LLL:EXT:vidi/Resources/Private/Language/content_module.xlf', |
|
47 | + ], |
|
48 | + ] |
|
49 | + ); |
|
50 | + } |
|
51 | + |
|
52 | + $configuration = GeneralUtility::makeInstance( |
|
53 | + ExtensionConfiguration::class |
|
54 | + )->get('vidi'); |
|
55 | + |
|
56 | + $pids = GeneralUtility::trimExplode(',', $configuration['default_pid'], true); |
|
57 | + $defaultPid = array_shift($pids); |
|
58 | + $defaultPids = []; |
|
59 | + foreach ($pids as $dataTypeAndPid) { |
|
60 | + $parts = GeneralUtility::trimExplode(':', $dataTypeAndPid); |
|
61 | + if (count($parts) === 2) { |
|
62 | + $defaultPids[$parts[0]] = $parts[1]; |
|
63 | + } |
|
64 | + } |
|
65 | + |
|
66 | + // Loop around the data types and register them to be displayed within a BE module. |
|
67 | + if ($configuration['data_types']) { |
|
68 | + $dataTypes = GeneralUtility::trimExplode(',', $configuration['data_types'], true); |
|
69 | + foreach ($dataTypes as $dataType) { |
|
70 | + /** @var ModuleLoader $moduleLoader */ |
|
71 | + $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class, $dataType); |
|
72 | + |
|
73 | + // Special case already defined in Vidi. |
|
74 | + if ($dataType === 'fe_users') { |
|
75 | + $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf'; |
|
76 | + $icon = 'EXT:vidi/Resources/Public/Images/fe_users.svg'; |
|
77 | + } elseif ($dataType === 'fe_groups') { |
|
78 | + $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf'; |
|
79 | + $icon = 'EXT:vidi/Resources/Public/Images/fe_groups.svg'; |
|
80 | + } else { |
|
81 | + /** @var LanguageFileGenerator $languageService */ |
|
82 | + $languageService = GeneralUtility::makeInstance(LanguageFileGenerator::class); |
|
83 | + $languageFile = $languageService->generate($dataType); |
|
84 | + $icon = ''; |
|
85 | + } |
|
86 | + |
|
87 | + $pid = $defaultPids[$dataType] ?? $defaultPid; |
|
88 | + |
|
89 | + /** @var ModuleLoader $moduleLoader */ |
|
90 | + $moduleLoader->setIcon($icon) |
|
91 | + ->setModuleLanguageFile($languageFile) |
|
92 | + ->setDefaultPid($pid) |
|
93 | + ->register(); |
|
94 | + } |
|
95 | + } |
|
96 | + |
|
97 | + // Possible Static TS loading |
|
98 | + if (true === isset($configuration['autoload_typoscript']) && false === (bool)$configuration['autoload_typoscript']) { |
|
99 | + ExtensionManagementUtility::addStaticFile('vidi', 'Configuration/TypoScript', 'Vidi: versatile and interactive display'); |
|
100 | + } |
|
101 | + |
|
102 | + // Register List2 only if beta feature is enabled. |
|
103 | + // @todo let see what we do with that |
|
104 | + #if ($configuration['activate_beta_features']) { |
|
105 | + # $labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module.xlf'; |
|
106 | + # |
|
107 | + # if (!$configuration['hide_module_list']) { |
|
108 | + # $labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module_transitional.xlf'; |
|
109 | + # } |
|
110 | + # |
|
111 | + # \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( |
|
112 | + # 'vidi', |
|
113 | + # 'web', // Make module a submodule of 'web' |
|
114 | + # 'm1', // Submodule key |
|
115 | + # 'after:list', // Position |
|
116 | + # array( |
|
117 | + # 'Content' => 'index, list, delete, update, edit, copy, move, localize, sort, copyClipboard, moveClipboard', |
|
118 | + # 'Tool' => 'welcome, work', |
|
119 | + # 'Facet' => 'autoSuggest, autoSuggests', |
|
120 | + # 'Selection' => 'edit, update, create, delete, list, show', |
|
121 | + # 'UserPreferences' => 'save', |
|
122 | + # 'Clipboard' => 'save, flush, show', |
|
123 | + # ), array( |
|
124 | + # 'access' => 'user,group', |
|
125 | + # 'icon' => 'EXT:vidi/Resources/Public/Images/list.png', |
|
126 | + # 'labels' => $labelFile, |
|
127 | + # ) |
|
128 | + # ); |
|
129 | + #} |
|
130 | + #if ($configuration['hide_module_list']) { |
|
131 | + # |
|
132 | + # // Default User TSConfig to be added in any case. |
|
133 | + # TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' |
|
134 | + # |
|
135 | + # # Hide the module in the BE. |
|
136 | + # options.hideModules.web := addToList(list) |
|
137 | + # '); |
|
138 | + #} |
|
139 | + |
|
140 | + /** @var $signalSlotDispatcher \TYPO3\CMS\Extbase\SignalSlot\Dispatcher */ |
|
141 | + $signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class); |
|
142 | + |
|
143 | + // Connect "processContentData" signal slot with the "ContentObjectProcessor". |
|
144 | + $signalSlotDispatcher->connect( |
|
145 | + 'Fab\Vidi\Controller\Backend\ContentController', |
|
146 | + 'processContentData', |
|
147 | + ContentObjectProcessor::class, |
|
148 | + 'processRelations', |
|
149 | + true |
|
150 | + ); |
|
151 | + |
|
152 | + // Connect "processContentData" signal with the "MarkerProcessor". |
|
153 | + $signalSlotDispatcher->connect( |
|
154 | + 'Fab\Vidi\Controller\Backend\ContentController', |
|
155 | + 'processContentData', |
|
156 | + MarkerProcessor::class, |
|
157 | + 'processMarkers', |
|
158 | + true |
|
159 | + ); |
|
160 | + |
|
161 | + // Register default Tools for Vidi. |
|
162 | + ToolRegistry::getInstance()->register('*', ModulePreferencesTool::class); |
|
163 | + ToolRegistry::getInstance()->register('*', RelationAnalyserTool::class); |
|
164 | + ToolRegistry::getInstance()->register('*', ConfiguredPidTool::class); |
|
165 | + |
|
166 | + // Add new sprite icon. |
|
167 | + $icons = [ |
|
168 | + 'go' => 'EXT:vidi/Resources/Public/Images/bullet_go.png', |
|
169 | + 'query' => 'EXT:vidi/Resources/Public/Images/drive_disk.png', |
|
170 | + ]; |
|
171 | + /** @var IconRegistry $iconRegistry */ |
|
172 | + $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); |
|
173 | + foreach ($icons as $key => $icon) { |
|
174 | + $iconRegistry->registerIcon( |
|
175 | + 'extensions-vidi-' . $key, |
|
176 | + BitmapIconProvider::class, |
|
177 | + [ |
|
178 | + 'source' => $icon |
|
179 | + ] |
|
180 | + ); |
|
181 | + } |
|
182 | + unset($iconRegistry); |
|
183 | 183 | }); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | defined('TYPO3') or die(); |
19 | 19 | |
20 | -call_user_func(function () { |
|
20 | +call_user_func(function() { |
|
21 | 21 | // Check from Vidi configuration what default module should be loaded. |
22 | 22 | // Make sure the class exists to avoid a Runtime Error |
23 | 23 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); |
173 | 173 | foreach ($icons as $key => $icon) { |
174 | 174 | $iconRegistry->registerIcon( |
175 | - 'extensions-vidi-' . $key, |
|
175 | + 'extensions-vidi-'.$key, |
|
176 | 176 | BitmapIconProvider::class, |
177 | 177 | [ |
178 | 178 | 'source' => $icon |