@@ -20,160 +20,160 @@ |
||
20 | 20 | class RelationRenderer extends ColumnRendererAbstract |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Render a representation of the relation on the GUI. |
|
25 | - * |
|
26 | - * @return string |
|
27 | - */ |
|
28 | - public function render() |
|
29 | - { |
|
30 | - if ($this->isBackendMode()) { |
|
31 | - $output = $this->renderForBackend(); |
|
32 | - } else { |
|
33 | - $output = $this->renderForFrontend(); |
|
34 | - } |
|
35 | - |
|
36 | - return $output; |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - protected function renderForBackend() |
|
43 | - { |
|
44 | - |
|
45 | - $output = ''; |
|
46 | - |
|
47 | - // Get label of the foreign table. |
|
48 | - $foreignLabelField = $this->getForeignTableLabelField($this->fieldName); |
|
49 | - |
|
50 | - if (Tca::table($this->object)->field($this->fieldName)->hasOne()) { |
|
51 | - |
|
52 | - $foreignObject = $this->object[$this->fieldName]; |
|
53 | - |
|
54 | - if ($foreignObject) { |
|
55 | - $output = sprintf( |
|
56 | - '<a href="%s" data-uid="%s" class="btn-edit invisible">%s</a> <span>%s</span>', |
|
57 | - $this->getEditUri($foreignObject), |
|
58 | - $this->object->getUid(), |
|
59 | - $this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL), |
|
60 | - $foreignObject[$foreignLabelField] |
|
61 | - ); |
|
62 | - } |
|
63 | - } elseif (Tca::table($this->object)->field($this->fieldName)->hasMany()) { |
|
64 | - |
|
65 | - if (!empty($this->object[$this->fieldName])) { |
|
66 | - |
|
67 | - /** @var $foreignObject \Fab\Vidi\Domain\Model\Content */ |
|
68 | - foreach ($this->object[$this->fieldName] as $foreignObject) { |
|
69 | - $output .= sprintf( |
|
70 | - '<li><a href="%s" data-uid="%s" class="btn-edit invisible">%s</a> <span>%s</span></li>', |
|
71 | - $this->getEditUri($foreignObject), |
|
72 | - $this->object->getUid(), |
|
73 | - $this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL), |
|
74 | - $foreignObject[$foreignLabelField] |
|
75 | - ); |
|
76 | - } |
|
77 | - $output = sprintf('<ul class="list-unstyled">%s</ul>', $output); |
|
78 | - } |
|
79 | - } |
|
80 | - return $output; |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * @return string |
|
85 | - */ |
|
86 | - protected function renderForFrontend() |
|
87 | - { |
|
88 | - |
|
89 | - $output = ''; |
|
90 | - |
|
91 | - // Get label of the foreign table. |
|
92 | - $foreignLabelField = $this->getForeignTableLabelField($this->fieldName); |
|
93 | - |
|
94 | - if (Tca::table($this->object)->field($this->fieldName)->hasOne()) { |
|
95 | - |
|
96 | - $foreignObject = $this->object[$this->fieldName]; |
|
97 | - |
|
98 | - if ($foreignObject) { |
|
99 | - $output = sprintf( |
|
100 | - '%s', |
|
101 | - $foreignObject[$foreignLabelField] |
|
102 | - ); |
|
103 | - } |
|
104 | - } elseif (Tca::table($this->object)->field($this->fieldName)->hasMany()) { |
|
105 | - |
|
106 | - if (!empty($this->object[$this->fieldName])) { |
|
107 | - |
|
108 | - /** @var $foreignObject \Fab\Vidi\Domain\Model\Content */ |
|
109 | - foreach ($this->object[$this->fieldName] as $foreignObject) { |
|
110 | - $output .= sprintf( |
|
111 | - '<li>%s</li>', |
|
112 | - $foreignObject[$foreignLabelField] |
|
113 | - ); |
|
114 | - } |
|
115 | - $output = sprintf('<ul class="list-unstyled">%s</ul>', $output); |
|
116 | - } |
|
117 | - } |
|
118 | - return $output; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * Render an edit URI given an object. |
|
123 | - * |
|
124 | - * @param Content $object |
|
125 | - * @return string |
|
126 | - */ |
|
127 | - protected function getEditUri(Content $object) |
|
128 | - { |
|
129 | - $uri = BackendUtility::getModuleUrl( |
|
130 | - 'record_edit', |
|
131 | - array( |
|
132 | - $this->getEditParameterName($object) => 'edit', |
|
133 | - 'returnUrl' => $this->getModuleLoader()->getModuleUrl() |
|
134 | - ) |
|
135 | - ); |
|
136 | - return $uri; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @param Content $object |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - protected function getEditParameterName(Content $object) |
|
144 | - { |
|
145 | - return sprintf( |
|
146 | - 'edit[%s][%s]', |
|
147 | - $object->getDataType(), |
|
148 | - $object->getUid() |
|
149 | - ); |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * Return the label field of the foreign table. |
|
154 | - * |
|
155 | - * @param string $fieldName |
|
156 | - * @return string |
|
157 | - */ |
|
158 | - protected function getForeignTableLabelField($fieldName) |
|
159 | - { |
|
160 | - |
|
161 | - // Get TCA table service. |
|
162 | - $table = Tca::table($this->object); |
|
163 | - |
|
164 | - // Compute the label of the foreign table. |
|
165 | - $relationDataType = $table->field($fieldName)->relationDataType(); |
|
166 | - return Tca::table($relationDataType)->getLabelField(); |
|
167 | - } |
|
168 | - |
|
169 | - /** |
|
170 | - * Returns whether the current mode is Frontend |
|
171 | - * |
|
172 | - * @return bool |
|
173 | - */ |
|
174 | - protected function isBackendMode() |
|
175 | - { |
|
176 | - return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); |
|
177 | - } |
|
23 | + /** |
|
24 | + * Render a representation of the relation on the GUI. |
|
25 | + * |
|
26 | + * @return string |
|
27 | + */ |
|
28 | + public function render() |
|
29 | + { |
|
30 | + if ($this->isBackendMode()) { |
|
31 | + $output = $this->renderForBackend(); |
|
32 | + } else { |
|
33 | + $output = $this->renderForFrontend(); |
|
34 | + } |
|
35 | + |
|
36 | + return $output; |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + protected function renderForBackend() |
|
43 | + { |
|
44 | + |
|
45 | + $output = ''; |
|
46 | + |
|
47 | + // Get label of the foreign table. |
|
48 | + $foreignLabelField = $this->getForeignTableLabelField($this->fieldName); |
|
49 | + |
|
50 | + if (Tca::table($this->object)->field($this->fieldName)->hasOne()) { |
|
51 | + |
|
52 | + $foreignObject = $this->object[$this->fieldName]; |
|
53 | + |
|
54 | + if ($foreignObject) { |
|
55 | + $output = sprintf( |
|
56 | + '<a href="%s" data-uid="%s" class="btn-edit invisible">%s</a> <span>%s</span>', |
|
57 | + $this->getEditUri($foreignObject), |
|
58 | + $this->object->getUid(), |
|
59 | + $this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL), |
|
60 | + $foreignObject[$foreignLabelField] |
|
61 | + ); |
|
62 | + } |
|
63 | + } elseif (Tca::table($this->object)->field($this->fieldName)->hasMany()) { |
|
64 | + |
|
65 | + if (!empty($this->object[$this->fieldName])) { |
|
66 | + |
|
67 | + /** @var $foreignObject \Fab\Vidi\Domain\Model\Content */ |
|
68 | + foreach ($this->object[$this->fieldName] as $foreignObject) { |
|
69 | + $output .= sprintf( |
|
70 | + '<li><a href="%s" data-uid="%s" class="btn-edit invisible">%s</a> <span>%s</span></li>', |
|
71 | + $this->getEditUri($foreignObject), |
|
72 | + $this->object->getUid(), |
|
73 | + $this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL), |
|
74 | + $foreignObject[$foreignLabelField] |
|
75 | + ); |
|
76 | + } |
|
77 | + $output = sprintf('<ul class="list-unstyled">%s</ul>', $output); |
|
78 | + } |
|
79 | + } |
|
80 | + return $output; |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * @return string |
|
85 | + */ |
|
86 | + protected function renderForFrontend() |
|
87 | + { |
|
88 | + |
|
89 | + $output = ''; |
|
90 | + |
|
91 | + // Get label of the foreign table. |
|
92 | + $foreignLabelField = $this->getForeignTableLabelField($this->fieldName); |
|
93 | + |
|
94 | + if (Tca::table($this->object)->field($this->fieldName)->hasOne()) { |
|
95 | + |
|
96 | + $foreignObject = $this->object[$this->fieldName]; |
|
97 | + |
|
98 | + if ($foreignObject) { |
|
99 | + $output = sprintf( |
|
100 | + '%s', |
|
101 | + $foreignObject[$foreignLabelField] |
|
102 | + ); |
|
103 | + } |
|
104 | + } elseif (Tca::table($this->object)->field($this->fieldName)->hasMany()) { |
|
105 | + |
|
106 | + if (!empty($this->object[$this->fieldName])) { |
|
107 | + |
|
108 | + /** @var $foreignObject \Fab\Vidi\Domain\Model\Content */ |
|
109 | + foreach ($this->object[$this->fieldName] as $foreignObject) { |
|
110 | + $output .= sprintf( |
|
111 | + '<li>%s</li>', |
|
112 | + $foreignObject[$foreignLabelField] |
|
113 | + ); |
|
114 | + } |
|
115 | + $output = sprintf('<ul class="list-unstyled">%s</ul>', $output); |
|
116 | + } |
|
117 | + } |
|
118 | + return $output; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * Render an edit URI given an object. |
|
123 | + * |
|
124 | + * @param Content $object |
|
125 | + * @return string |
|
126 | + */ |
|
127 | + protected function getEditUri(Content $object) |
|
128 | + { |
|
129 | + $uri = BackendUtility::getModuleUrl( |
|
130 | + 'record_edit', |
|
131 | + array( |
|
132 | + $this->getEditParameterName($object) => 'edit', |
|
133 | + 'returnUrl' => $this->getModuleLoader()->getModuleUrl() |
|
134 | + ) |
|
135 | + ); |
|
136 | + return $uri; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @param Content $object |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + protected function getEditParameterName(Content $object) |
|
144 | + { |
|
145 | + return sprintf( |
|
146 | + 'edit[%s][%s]', |
|
147 | + $object->getDataType(), |
|
148 | + $object->getUid() |
|
149 | + ); |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * Return the label field of the foreign table. |
|
154 | + * |
|
155 | + * @param string $fieldName |
|
156 | + * @return string |
|
157 | + */ |
|
158 | + protected function getForeignTableLabelField($fieldName) |
|
159 | + { |
|
160 | + |
|
161 | + // Get TCA table service. |
|
162 | + $table = Tca::table($this->object); |
|
163 | + |
|
164 | + // Compute the label of the foreign table. |
|
165 | + $relationDataType = $table->field($fieldName)->relationDataType(); |
|
166 | + return Tca::table($relationDataType)->getLabelField(); |
|
167 | + } |
|
168 | + |
|
169 | + /** |
|
170 | + * Returns whether the current mode is Frontend |
|
171 | + * |
|
172 | + * @return bool |
|
173 | + */ |
|
174 | + protected function isBackendMode() |
|
175 | + { |
|
176 | + return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); |
|
177 | + } |
|
178 | 178 | |
179 | 179 | } |
@@ -18,56 +18,56 @@ |
||
18 | 18 | class RelationEditRenderer extends ColumnRendererAbstract |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - public function render() |
|
25 | - { |
|
26 | - $output = ''; |
|
27 | - if ($this->isBackendMode()) { |
|
28 | - $output = $this->renderForBackend(); |
|
29 | - } |
|
21 | + /** |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + public function render() |
|
25 | + { |
|
26 | + $output = ''; |
|
27 | + if ($this->isBackendMode()) { |
|
28 | + $output = $this->renderForBackend(); |
|
29 | + } |
|
30 | 30 | |
31 | - return $output; |
|
32 | - } |
|
31 | + return $output; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - protected function renderForBackend() |
|
38 | - { |
|
34 | + /** |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + protected function renderForBackend() |
|
38 | + { |
|
39 | 39 | |
40 | - // Initialize url parameters array. |
|
41 | - $urlParameters = array( |
|
42 | - $this->getModuleLoader()->getParameterPrefix() => array( |
|
43 | - 'controller' => 'Content', |
|
44 | - 'action' => 'edit', |
|
45 | - 'matches' => array('uid' => $this->object->getUid()), |
|
46 | - 'fieldNameAndPath' => $this->getFieldName(), |
|
47 | - ), |
|
48 | - ); |
|
40 | + // Initialize url parameters array. |
|
41 | + $urlParameters = array( |
|
42 | + $this->getModuleLoader()->getParameterPrefix() => array( |
|
43 | + 'controller' => 'Content', |
|
44 | + 'action' => 'edit', |
|
45 | + 'matches' => array('uid' => $this->object->getUid()), |
|
46 | + 'fieldNameAndPath' => $this->getFieldName(), |
|
47 | + ), |
|
48 | + ); |
|
49 | 49 | |
50 | - $fieldLabel = Tca::table()->field($this->getFieldName())->getLabel(); |
|
51 | - if ($fieldLabel) { |
|
52 | - $fieldLabel = str_replace(':', '', $fieldLabel); // sanitize label |
|
53 | - } |
|
50 | + $fieldLabel = Tca::table()->field($this->getFieldName())->getLabel(); |
|
51 | + if ($fieldLabel) { |
|
52 | + $fieldLabel = str_replace(':', '', $fieldLabel); // sanitize label |
|
53 | + } |
|
54 | 54 | |
55 | - return sprintf( |
|
56 | - '<div style="text-align: right" class="pull-right invisible"><a href="%s" class="btn-edit-relation" data-field-label="%s">%s</a></div>', |
|
57 | - $this->getModuleLoader()->getModuleUrl($urlParameters), |
|
58 | - $fieldLabel, |
|
59 | - $this->getIconFactory()->getIcon('actions-add', Icon::SIZE_SMALL) |
|
60 | - ); |
|
61 | - } |
|
55 | + return sprintf( |
|
56 | + '<div style="text-align: right" class="pull-right invisible"><a href="%s" class="btn-edit-relation" data-field-label="%s">%s</a></div>', |
|
57 | + $this->getModuleLoader()->getModuleUrl($urlParameters), |
|
58 | + $fieldLabel, |
|
59 | + $this->getIconFactory()->getIcon('actions-add', Icon::SIZE_SMALL) |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Returns whether the current mode is Frontend |
|
65 | - * |
|
66 | - * @return bool |
|
67 | - */ |
|
68 | - protected function isBackendMode() |
|
69 | - { |
|
70 | - return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend();; |
|
71 | - } |
|
63 | + /** |
|
64 | + * Returns whether the current mode is Frontend |
|
65 | + * |
|
66 | + * @return bool |
|
67 | + */ |
|
68 | + protected function isBackendMode() |
|
69 | + { |
|
70 | + return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend();; |
|
71 | + } |
|
72 | 72 | |
73 | 73 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | */ |
68 | 68 | protected function isBackendMode() |
69 | 69 | { |
70 | - return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend();; |
|
70 | + return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); ; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | } |
@@ -22,86 +22,86 @@ |
||
22 | 22 | class FileReferenceService implements SingletonInterface |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @var array |
|
27 | - */ |
|
28 | - static protected $instances = []; |
|
29 | - |
|
30 | - /** |
|
31 | - * Returns a class instance |
|
32 | - * |
|
33 | - * @return \Fab\Vidi\Service\FileReferenceService|object |
|
34 | - */ |
|
35 | - static public function getInstance() |
|
36 | - { |
|
37 | - return GeneralUtility::makeInstance(\Fab\Vidi\Service\FileReferenceService::class); |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * @param Content $object |
|
42 | - * @param string $propertyName |
|
43 | - * @return File[] |
|
44 | - */ |
|
45 | - public function findReferencedBy($propertyName, Content $object) |
|
46 | - { |
|
47 | - |
|
48 | - if (!isset(self::$instances[$object->getUid()][$propertyName])) { |
|
49 | - |
|
50 | - // Initialize instances value |
|
51 | - if (!isset(self::$instances[$object->getUid()])) { |
|
52 | - self::$instances[$object->getUid()] = []; |
|
53 | - } |
|
54 | - |
|
55 | - $fieldName = GeneralUtility::camelCaseToLowerCaseUnderscored($propertyName); |
|
56 | - $field = Tca::table($object->getDataType())->field($fieldName); |
|
57 | - if ($field->getForeignTable() === 'sys_file_reference') { |
|
58 | - $files = $this->findByFileReference($propertyName, $object); |
|
59 | - self::$instances[$object->getUid()][$propertyName] = $files; |
|
60 | - } else { |
|
61 | - // @todo the standard way of handling file references is by "sys_file_reference". Let see if there is other use cases... |
|
62 | - } |
|
63 | - } |
|
64 | - |
|
65 | - return self::$instances[$object->getUid()][$propertyName]; |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * Fetch the files given an object assuming |
|
70 | - * |
|
71 | - * @param $propertyName |
|
72 | - * @param Content $object |
|
73 | - * @return File[] |
|
74 | - */ |
|
75 | - protected function findByFileReference($propertyName, Content $object) |
|
76 | - { |
|
77 | - |
|
78 | - $fileField = 'uid_local'; |
|
79 | - $tableName = 'sys_file_reference'; |
|
80 | - |
|
81 | - $rows = $this->getDataService()->getRecords( |
|
82 | - $tableName, |
|
83 | - [ |
|
84 | - 'tablenames' => $object->getDataType(), |
|
85 | - 'fieldname'=> GeneralUtility::camelCaseToLowerCaseUnderscored($propertyName), |
|
86 | - 'uid_foreign'=> $object->getUid(), |
|
87 | - ] |
|
88 | - ); |
|
89 | - |
|
90 | - // Build array of Files |
|
91 | - $files = []; |
|
92 | - foreach ($rows as $row) { |
|
93 | - $files[] = GeneralUtility::makeInstance(ResourceFactory::class)->getFileObject($row[$fileField]); |
|
94 | - } |
|
95 | - |
|
96 | - return $files; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @return object|DataService |
|
101 | - */ |
|
102 | - protected function getDataService(): DataService |
|
103 | - { |
|
104 | - return GeneralUtility::makeInstance(DataService::class); |
|
105 | - } |
|
25 | + /** |
|
26 | + * @var array |
|
27 | + */ |
|
28 | + static protected $instances = []; |
|
29 | + |
|
30 | + /** |
|
31 | + * Returns a class instance |
|
32 | + * |
|
33 | + * @return \Fab\Vidi\Service\FileReferenceService|object |
|
34 | + */ |
|
35 | + static public function getInstance() |
|
36 | + { |
|
37 | + return GeneralUtility::makeInstance(\Fab\Vidi\Service\FileReferenceService::class); |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * @param Content $object |
|
42 | + * @param string $propertyName |
|
43 | + * @return File[] |
|
44 | + */ |
|
45 | + public function findReferencedBy($propertyName, Content $object) |
|
46 | + { |
|
47 | + |
|
48 | + if (!isset(self::$instances[$object->getUid()][$propertyName])) { |
|
49 | + |
|
50 | + // Initialize instances value |
|
51 | + if (!isset(self::$instances[$object->getUid()])) { |
|
52 | + self::$instances[$object->getUid()] = []; |
|
53 | + } |
|
54 | + |
|
55 | + $fieldName = GeneralUtility::camelCaseToLowerCaseUnderscored($propertyName); |
|
56 | + $field = Tca::table($object->getDataType())->field($fieldName); |
|
57 | + if ($field->getForeignTable() === 'sys_file_reference') { |
|
58 | + $files = $this->findByFileReference($propertyName, $object); |
|
59 | + self::$instances[$object->getUid()][$propertyName] = $files; |
|
60 | + } else { |
|
61 | + // @todo the standard way of handling file references is by "sys_file_reference". Let see if there is other use cases... |
|
62 | + } |
|
63 | + } |
|
64 | + |
|
65 | + return self::$instances[$object->getUid()][$propertyName]; |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * Fetch the files given an object assuming |
|
70 | + * |
|
71 | + * @param $propertyName |
|
72 | + * @param Content $object |
|
73 | + * @return File[] |
|
74 | + */ |
|
75 | + protected function findByFileReference($propertyName, Content $object) |
|
76 | + { |
|
77 | + |
|
78 | + $fileField = 'uid_local'; |
|
79 | + $tableName = 'sys_file_reference'; |
|
80 | + |
|
81 | + $rows = $this->getDataService()->getRecords( |
|
82 | + $tableName, |
|
83 | + [ |
|
84 | + 'tablenames' => $object->getDataType(), |
|
85 | + 'fieldname'=> GeneralUtility::camelCaseToLowerCaseUnderscored($propertyName), |
|
86 | + 'uid_foreign'=> $object->getUid(), |
|
87 | + ] |
|
88 | + ); |
|
89 | + |
|
90 | + // Build array of Files |
|
91 | + $files = []; |
|
92 | + foreach ($rows as $row) { |
|
93 | + $files[] = GeneralUtility::makeInstance(ResourceFactory::class)->getFileObject($row[$fileField]); |
|
94 | + } |
|
95 | + |
|
96 | + return $files; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @return object|DataService |
|
101 | + */ |
|
102 | + protected function getDataService(): DataService |
|
103 | + { |
|
104 | + return GeneralUtility::makeInstance(DataService::class); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | use Fab\Vidi\Domain\Model\Content; |
18 | 18 | use Fab\Vidi\Tests\Functional\AbstractFunctionalTestCase; |
19 | 19 | |
20 | -require_once dirname(dirname(__FILE__)) . '/AbstractFunctionalTestCase.php'; |
|
20 | +require_once dirname(dirname(__FILE__)).'/AbstractFunctionalTestCase.php'; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Test case for class \Fab\Vidi\Grid\CategoryRenderer. |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use Fab\Vidi\Module\ModuleLoader; |
17 | 17 | use Fab\Vidi\Tests\Functional\AbstractFunctionalTestCase; |
18 | 18 | |
19 | -require_once dirname(dirname(__FILE__)) . '/AbstractFunctionalTestCase.php'; |
|
19 | +require_once dirname(dirname(__FILE__)).'/AbstractFunctionalTestCase.php'; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Test case for class \Fab\Vidi\Module\ModuleLoader. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @dataProvider attributeValueProvider |
55 | 55 | */ |
56 | 56 | public function attributeCanBeSet($attribute, $value) { |
57 | - $setter = 'set' . ucfirst($attribute); |
|
57 | + $setter = 'set'.ucfirst($attribute); |
|
58 | 58 | $this->fixture->$setter($value); |
59 | 59 | $this->assertAttributeEquals($value, $attribute, $this->fixture); |
60 | 60 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | use Fab\Vidi\Domain\Model\Selection; |
5 | 5 | |
6 | 6 | return [ |
7 | - Selection::class => [ |
|
8 | - 'tableName' => 'tx_vidi_selection', |
|
9 | - ], |
|
7 | + Selection::class => [ |
|
8 | + 'tableName' => 'tx_vidi_selection', |
|
9 | + ], |
|
10 | 10 | ]; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | use Fab\Vidi\Domain\Model\Selection; |
5 | 5 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * example: bin/typo3 vidi:analyseRelations |
6 | 6 | */ |
7 | 7 | return [ |
8 | - 'vidi:analyseRelations' => [ |
|
9 | - 'class' => VidiCommandController::class |
|
10 | - ], |
|
8 | + 'vidi:analyseRelations' => [ |
|
9 | + 'class' => VidiCommandController::class |
|
10 | + ], |
|
11 | 11 | ]; |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | if (!defined('TYPO3')) die ('Access denied.'); |
6 | 6 | |
7 | 7 | $tca = [ |
8 | - 'grid' => [ |
|
9 | - 'excluded_fields' => 'image, imagewidth, imageorient, imagecols, imageborder, image_noRows, image_effects, image_compression, tx_impexp_origuid, image_zoom, |
|
8 | + 'grid' => [ |
|
9 | + 'excluded_fields' => 'image, imagewidth, imageorient, imagecols, imageborder, image_noRows, image_effects, image_compression, tx_impexp_origuid, image_zoom, |
|
10 | 10 | spaceAfter, spaceBefore, |
11 | 11 | uploads_description, uploads_type, |
12 | 12 | media, assets, table_caption, table_delimiter, table_enclosure, table_header_position, table_tfoot, table_bgColor, table_border, table_cellpadding, table_cellspacing, |
@@ -16,39 +16,39 @@ discard block |
||
16 | 16 | target, linkToTop, menu_type, list_type, select_key, |
17 | 17 | file_collections, filelink_size, filelink_sorting, |
18 | 18 | external_media_ratio, external_media_source', |
19 | - 'columns' => [ |
|
20 | - '__checkbox' => [ |
|
21 | - 'renderer' => CheckBoxRenderer::class, |
|
22 | - ], |
|
23 | - 'uid' => [ |
|
24 | - 'visible' => false, |
|
25 | - 'label' => 'Id', |
|
26 | - 'width' => '5px', |
|
27 | - ], |
|
28 | - 'header' => [ |
|
29 | - 'editable' => true, |
|
30 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tt_content.xlf:header', |
|
31 | - ], |
|
32 | - 'tstamp' => [ |
|
33 | - 'visible' => false, |
|
34 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
35 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
36 | - ], |
|
37 | - 'crdate' => [ |
|
38 | - 'visible' => false, |
|
39 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
40 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
41 | - ], |
|
42 | - 'hidden' => [ |
|
43 | - 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
44 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
45 | - 'width' => '3%', |
|
46 | - ], |
|
47 | - '__buttons' => [ |
|
48 | - 'renderer' => ButtonGroupRenderer::class, |
|
49 | - ], |
|
50 | - ], |
|
51 | - ], |
|
19 | + 'columns' => [ |
|
20 | + '__checkbox' => [ |
|
21 | + 'renderer' => CheckBoxRenderer::class, |
|
22 | + ], |
|
23 | + 'uid' => [ |
|
24 | + 'visible' => false, |
|
25 | + 'label' => 'Id', |
|
26 | + 'width' => '5px', |
|
27 | + ], |
|
28 | + 'header' => [ |
|
29 | + 'editable' => true, |
|
30 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tt_content.xlf:header', |
|
31 | + ], |
|
32 | + 'tstamp' => [ |
|
33 | + 'visible' => false, |
|
34 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
35 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
36 | + ], |
|
37 | + 'crdate' => [ |
|
38 | + 'visible' => false, |
|
39 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
40 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
41 | + ], |
|
42 | + 'hidden' => [ |
|
43 | + 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
44 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
45 | + 'width' => '3%', |
|
46 | + ], |
|
47 | + '__buttons' => [ |
|
48 | + 'renderer' => ButtonGroupRenderer::class, |
|
49 | + ], |
|
50 | + ], |
|
51 | + ], |
|
52 | 52 | ]; |
53 | 53 | |
54 | 54 | ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['tt_content'], $tca); |
@@ -2,7 +2,9 @@ |
||
2 | 2 | use Fab\Vidi\Grid\CheckBoxRenderer; |
3 | 3 | use Fab\Vidi\Grid\ButtonGroupRenderer; |
4 | 4 | use TYPO3\CMS\Core\Utility\ArrayUtility; |
5 | -if (!defined('TYPO3')) die ('Access denied.'); |
|
5 | +if (!defined('TYPO3')) { |
|
6 | + die ('Access denied.'); |
|
7 | +} |
|
6 | 8 | |
7 | 9 | $tca = [ |
8 | 10 | 'grid' => [ |
@@ -7,110 +7,110 @@ |
||
7 | 7 | if (!defined('TYPO3')) die ('Access denied.'); |
8 | 8 | |
9 | 9 | $tca = [ |
10 | - 'ctrl' => [ |
|
11 | - // By default "searchFields" has many fields which has a performance cost when dealing with large data-set. |
|
12 | - // Override search field for performance reason. |
|
13 | - // To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup', |
|
14 | - 'searchFields' => 'username, first_name, last_name, usergroup', |
|
15 | - ], |
|
16 | - 'vidi' => [ |
|
17 | - // Special case when the field name does not follow the conventions. |
|
18 | - // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
19 | - 'mappings' => [ |
|
20 | - 'lockToDomain' => 'lockToDomain', |
|
21 | - 'TSconfig' => 'tsConfig', |
|
22 | - 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
23 | - 'felogin_forgotHash' => 'feLoginForgotHash', |
|
24 | - ], |
|
25 | - ], |
|
26 | - 'grid' => [ |
|
27 | - 'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token, image', |
|
28 | - 'export' => [ |
|
29 | - 'include_files' => false, |
|
30 | - ], |
|
31 | - 'facets' => [ |
|
32 | - 'uid', |
|
33 | - 'username', |
|
34 | - 'name', |
|
35 | - 'first_name', |
|
36 | - 'last_name', |
|
37 | - 'middle_name', |
|
38 | - 'address', |
|
39 | - 'telephone', |
|
40 | - 'fax', |
|
41 | - 'email', |
|
42 | - 'title', |
|
43 | - 'zip', |
|
44 | - 'city', |
|
45 | - 'country', |
|
46 | - 'company', |
|
47 | - 'usergroup', |
|
48 | - StandardFacet::class => [ |
|
49 | - 'name' => 'disable', |
|
50 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
51 | - 'suggestions' => [ |
|
52 | - '0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0', |
|
53 | - '1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1' |
|
54 | - ] |
|
55 | - ], |
|
56 | - PageFacet::class => [ |
|
57 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
58 | - ], |
|
59 | - ], |
|
60 | - 'columns' => [ |
|
61 | - '__checkbox' => [ |
|
62 | - 'renderer' => CheckBoxRenderer::class, |
|
63 | - ], |
|
64 | - 'uid' => [ |
|
65 | - 'visible' => false, |
|
66 | - 'label' => 'Id', |
|
67 | - 'width' => '5px', |
|
68 | - ], |
|
69 | - 'username' => [ |
|
70 | - 'visible' => true, |
|
71 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username', |
|
72 | - 'editable' => true, |
|
73 | - ], |
|
74 | - 'name' => [ |
|
75 | - 'visible' => true, |
|
76 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name', |
|
77 | - 'editable' => true, |
|
78 | - ], |
|
79 | - 'email' => [ |
|
80 | - 'visible' => true, |
|
81 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email', |
|
82 | - 'editable' => true, |
|
83 | - ], |
|
84 | - 'usergroup' => [ |
|
85 | - 'visible' => true, |
|
86 | - 'renderers' => [ |
|
87 | - 'Fab\Vidi\Grid\RelationEditRenderer', |
|
88 | - 'Fab\Vidi\Grid\RelationRenderer', |
|
89 | - ], |
|
90 | - 'editable' => true, |
|
91 | - 'sortable' => false, |
|
92 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup', |
|
93 | - ], |
|
94 | - 'tstamp' => [ |
|
95 | - 'visible' => false, |
|
96 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
97 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
98 | - ], |
|
99 | - 'crdate' => [ |
|
100 | - 'visible' => false, |
|
101 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
102 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
103 | - ], |
|
104 | - 'disable' => [ |
|
105 | - 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
106 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
107 | - 'width' => '3%', |
|
108 | - ], |
|
109 | - '__buttons' => [ |
|
110 | - 'renderer' => ButtonGroupRenderer::class, |
|
111 | - ], |
|
112 | - ], |
|
113 | - ], |
|
10 | + 'ctrl' => [ |
|
11 | + // By default "searchFields" has many fields which has a performance cost when dealing with large data-set. |
|
12 | + // Override search field for performance reason. |
|
13 | + // To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup', |
|
14 | + 'searchFields' => 'username, first_name, last_name, usergroup', |
|
15 | + ], |
|
16 | + 'vidi' => [ |
|
17 | + // Special case when the field name does not follow the conventions. |
|
18 | + // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
19 | + 'mappings' => [ |
|
20 | + 'lockToDomain' => 'lockToDomain', |
|
21 | + 'TSconfig' => 'tsConfig', |
|
22 | + 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
23 | + 'felogin_forgotHash' => 'feLoginForgotHash', |
|
24 | + ], |
|
25 | + ], |
|
26 | + 'grid' => [ |
|
27 | + 'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token, image', |
|
28 | + 'export' => [ |
|
29 | + 'include_files' => false, |
|
30 | + ], |
|
31 | + 'facets' => [ |
|
32 | + 'uid', |
|
33 | + 'username', |
|
34 | + 'name', |
|
35 | + 'first_name', |
|
36 | + 'last_name', |
|
37 | + 'middle_name', |
|
38 | + 'address', |
|
39 | + 'telephone', |
|
40 | + 'fax', |
|
41 | + 'email', |
|
42 | + 'title', |
|
43 | + 'zip', |
|
44 | + 'city', |
|
45 | + 'country', |
|
46 | + 'company', |
|
47 | + 'usergroup', |
|
48 | + StandardFacet::class => [ |
|
49 | + 'name' => 'disable', |
|
50 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
51 | + 'suggestions' => [ |
|
52 | + '0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0', |
|
53 | + '1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1' |
|
54 | + ] |
|
55 | + ], |
|
56 | + PageFacet::class => [ |
|
57 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
58 | + ], |
|
59 | + ], |
|
60 | + 'columns' => [ |
|
61 | + '__checkbox' => [ |
|
62 | + 'renderer' => CheckBoxRenderer::class, |
|
63 | + ], |
|
64 | + 'uid' => [ |
|
65 | + 'visible' => false, |
|
66 | + 'label' => 'Id', |
|
67 | + 'width' => '5px', |
|
68 | + ], |
|
69 | + 'username' => [ |
|
70 | + 'visible' => true, |
|
71 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username', |
|
72 | + 'editable' => true, |
|
73 | + ], |
|
74 | + 'name' => [ |
|
75 | + 'visible' => true, |
|
76 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name', |
|
77 | + 'editable' => true, |
|
78 | + ], |
|
79 | + 'email' => [ |
|
80 | + 'visible' => true, |
|
81 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email', |
|
82 | + 'editable' => true, |
|
83 | + ], |
|
84 | + 'usergroup' => [ |
|
85 | + 'visible' => true, |
|
86 | + 'renderers' => [ |
|
87 | + 'Fab\Vidi\Grid\RelationEditRenderer', |
|
88 | + 'Fab\Vidi\Grid\RelationRenderer', |
|
89 | + ], |
|
90 | + 'editable' => true, |
|
91 | + 'sortable' => false, |
|
92 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup', |
|
93 | + ], |
|
94 | + 'tstamp' => [ |
|
95 | + 'visible' => false, |
|
96 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
97 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
98 | + ], |
|
99 | + 'crdate' => [ |
|
100 | + 'visible' => false, |
|
101 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
102 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
103 | + ], |
|
104 | + 'disable' => [ |
|
105 | + 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
106 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
107 | + 'width' => '3%', |
|
108 | + ], |
|
109 | + '__buttons' => [ |
|
110 | + 'renderer' => ButtonGroupRenderer::class, |
|
111 | + ], |
|
112 | + ], |
|
113 | + ], |
|
114 | 114 | ]; |
115 | 115 | |
116 | 116 | ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_users'], $tca); |
@@ -4,7 +4,9 @@ |
||
4 | 4 | use Fab\Vidi\Grid\CheckBoxRenderer; |
5 | 5 | use Fab\Vidi\Grid\ButtonGroupRenderer; |
6 | 6 | use TYPO3\CMS\Core\Utility\ArrayUtility; |
7 | -if (!defined('TYPO3')) die ('Access denied.'); |
|
7 | +if (!defined('TYPO3')) { |
|
8 | + die ('Access denied.'); |
|
9 | +} |
|
8 | 10 | |
9 | 11 | $tca = [ |
10 | 12 | 'ctrl' => [ |