@@ -16,108 +16,108 @@ |
||
16 | 16 | */ |
17 | 17 | class GridAnalyserService |
18 | 18 | { |
19 | - /** |
|
20 | - * Check relation for table. |
|
21 | - * |
|
22 | - * @param $tableName |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function checkRelationForTable($tableName) |
|
26 | - { |
|
27 | - $relations = []; |
|
28 | - $table = Tca::table($tableName); |
|
29 | - |
|
30 | - $missingOppositionRelationMessage = <<<EOF |
|
19 | + /** |
|
20 | + * Check relation for table. |
|
21 | + * |
|
22 | + * @param $tableName |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function checkRelationForTable($tableName) |
|
26 | + { |
|
27 | + $relations = []; |
|
28 | + $table = Tca::table($tableName); |
|
29 | + |
|
30 | + $missingOppositionRelationMessage = <<<EOF |
|
31 | 31 | |
32 | 32 | WARNING! Could not define relation precisely. This is not necessarily a problem |
33 | 33 | if the opposite relation is not required in a Grid. But consider adding the opposite |
34 | 34 | TCA configuration if so. |
35 | 35 | EOF; |
36 | 36 | |
37 | - foreach (Tca::grid($tableName)->getFields() as $fieldName => $configuration) { |
|
38 | - if ($table->hasField($fieldName)) { |
|
39 | - if ($table->field($fieldName)->hasMany()) { |
|
40 | - if ($table->field($fieldName)->hasRelationWithCommaSeparatedValues()) { |
|
41 | - $_relations = $this->checkRelationOf($tableName, $fieldName, 'comma separated values'); |
|
42 | - $relations = array_merge($relations, $_relations); |
|
43 | - } elseif ($table->field($fieldName)->hasRelationManyToMany()) { |
|
44 | - $_relations = $this->checkRelationManyToMany($tableName, $fieldName); |
|
45 | - $relations = array_merge($relations, $_relations); |
|
46 | - } elseif ($table->field($fieldName)->hasRelationOneToMany()) { |
|
47 | - $_relations = $this->checkRelationOf($tableName, $fieldName, 'one-to-many'); |
|
48 | - $relations = array_merge($relations, $_relations); |
|
49 | - } else { |
|
50 | - $relations[] = sprintf('* field: "%s", relation: ?-to-many%s', $fieldName, $missingOppositionRelationMessage); |
|
51 | - } |
|
52 | - $relations[] = ''; |
|
53 | - } elseif ($table->field($fieldName)->hasOne()) { |
|
54 | - if ($table->field($fieldName)->hasRelationOneToOne()) { |
|
55 | - $relations[] = sprintf('* one-to-one "%s"', $fieldName); |
|
56 | - } elseif ($table->field($fieldName)->hasRelationManyToOne()) { |
|
57 | - $_relations = $this->checkRelationOf($tableName, $fieldName, 'many-to-one'); |
|
58 | - $relations = array_merge($relations, $_relations); |
|
59 | - } else { |
|
60 | - $relations[] = sprintf('* field: "%s", relation: ?-to-one%s', $fieldName, $missingOppositionRelationMessage); |
|
61 | - } |
|
62 | - $relations[] = ''; |
|
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - return $relations; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Convenience method for printing out relation many-to-many. |
|
71 | - * |
|
72 | - * @param string $tableName |
|
73 | - * @param string $fieldName |
|
74 | - * @return array |
|
75 | - */ |
|
76 | - protected function checkRelationManyToMany($tableName, $fieldName) |
|
77 | - { |
|
78 | - $output = []; |
|
79 | - |
|
80 | - $table = Tca::table($tableName); |
|
81 | - $output[] = sprintf('* field: "%s", relation: many-to-many', $fieldName); |
|
82 | - |
|
83 | - $foreignTable = $table->field($fieldName)->getForeignTable(); |
|
84 | - $manyToManyTable = $table->field($fieldName)->getManyToManyTable(); |
|
85 | - $foreignField = $table->field($fieldName)->getForeignField(); |
|
86 | - |
|
87 | - if (!$foreignField) { |
|
88 | - $output[] = sprintf(' ERROR! Can not found foreign field for "%s". Perhaps missing opposite configuration?', $fieldName); |
|
89 | - } elseif (!$foreignTable) { |
|
90 | - $output[] = sprintf(' ERROR! Can not found foreign table for "%s". Perhaps missing opposite configuration?', $fieldName); |
|
91 | - } elseif (!$manyToManyTable) { |
|
92 | - $output[] = sprintf(' ERROR! Can not found relation table (MM) for "%s". Perhaps missing opposite configuration?', $fieldName); |
|
93 | - } else { |
|
94 | - $output[] = sprintf(' %s.%s <--> %s <--> %s.%s', $tableName, $fieldName, $manyToManyTable, $foreignTable, $foreignField); |
|
95 | - } |
|
96 | - |
|
97 | - $output[] = ''; |
|
98 | - return $output; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Convenience method for printing out relation. |
|
103 | - * |
|
104 | - * @param string $tableName |
|
105 | - * @param string $fieldName |
|
106 | - * @param string $relationType |
|
107 | - * @return array |
|
108 | - */ |
|
109 | - protected function checkRelationOf($tableName, $fieldName, $relationType) |
|
110 | - { |
|
111 | - $output = []; |
|
112 | - |
|
113 | - $table = Tca::table($tableName); |
|
114 | - $output[] = sprintf('* field: "%s", relation: %s', $fieldName, $relationType); |
|
115 | - |
|
116 | - $foreignTable = $table->field($fieldName)->getForeignTable(); |
|
117 | - $foreignField = $table->field($fieldName)->getForeignField(); |
|
118 | - $output[] = sprintf(' %s.%s <--> %s.%s', $tableName, $fieldName, $foreignTable, $foreignField); |
|
119 | - $output[] = ''; |
|
120 | - |
|
121 | - return $output; |
|
122 | - } |
|
37 | + foreach (Tca::grid($tableName)->getFields() as $fieldName => $configuration) { |
|
38 | + if ($table->hasField($fieldName)) { |
|
39 | + if ($table->field($fieldName)->hasMany()) { |
|
40 | + if ($table->field($fieldName)->hasRelationWithCommaSeparatedValues()) { |
|
41 | + $_relations = $this->checkRelationOf($tableName, $fieldName, 'comma separated values'); |
|
42 | + $relations = array_merge($relations, $_relations); |
|
43 | + } elseif ($table->field($fieldName)->hasRelationManyToMany()) { |
|
44 | + $_relations = $this->checkRelationManyToMany($tableName, $fieldName); |
|
45 | + $relations = array_merge($relations, $_relations); |
|
46 | + } elseif ($table->field($fieldName)->hasRelationOneToMany()) { |
|
47 | + $_relations = $this->checkRelationOf($tableName, $fieldName, 'one-to-many'); |
|
48 | + $relations = array_merge($relations, $_relations); |
|
49 | + } else { |
|
50 | + $relations[] = sprintf('* field: "%s", relation: ?-to-many%s', $fieldName, $missingOppositionRelationMessage); |
|
51 | + } |
|
52 | + $relations[] = ''; |
|
53 | + } elseif ($table->field($fieldName)->hasOne()) { |
|
54 | + if ($table->field($fieldName)->hasRelationOneToOne()) { |
|
55 | + $relations[] = sprintf('* one-to-one "%s"', $fieldName); |
|
56 | + } elseif ($table->field($fieldName)->hasRelationManyToOne()) { |
|
57 | + $_relations = $this->checkRelationOf($tableName, $fieldName, 'many-to-one'); |
|
58 | + $relations = array_merge($relations, $_relations); |
|
59 | + } else { |
|
60 | + $relations[] = sprintf('* field: "%s", relation: ?-to-one%s', $fieldName, $missingOppositionRelationMessage); |
|
61 | + } |
|
62 | + $relations[] = ''; |
|
63 | + } |
|
64 | + } |
|
65 | + } |
|
66 | + return $relations; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Convenience method for printing out relation many-to-many. |
|
71 | + * |
|
72 | + * @param string $tableName |
|
73 | + * @param string $fieldName |
|
74 | + * @return array |
|
75 | + */ |
|
76 | + protected function checkRelationManyToMany($tableName, $fieldName) |
|
77 | + { |
|
78 | + $output = []; |
|
79 | + |
|
80 | + $table = Tca::table($tableName); |
|
81 | + $output[] = sprintf('* field: "%s", relation: many-to-many', $fieldName); |
|
82 | + |
|
83 | + $foreignTable = $table->field($fieldName)->getForeignTable(); |
|
84 | + $manyToManyTable = $table->field($fieldName)->getManyToManyTable(); |
|
85 | + $foreignField = $table->field($fieldName)->getForeignField(); |
|
86 | + |
|
87 | + if (!$foreignField) { |
|
88 | + $output[] = sprintf(' ERROR! Can not found foreign field for "%s". Perhaps missing opposite configuration?', $fieldName); |
|
89 | + } elseif (!$foreignTable) { |
|
90 | + $output[] = sprintf(' ERROR! Can not found foreign table for "%s". Perhaps missing opposite configuration?', $fieldName); |
|
91 | + } elseif (!$manyToManyTable) { |
|
92 | + $output[] = sprintf(' ERROR! Can not found relation table (MM) for "%s". Perhaps missing opposite configuration?', $fieldName); |
|
93 | + } else { |
|
94 | + $output[] = sprintf(' %s.%s <--> %s <--> %s.%s', $tableName, $fieldName, $manyToManyTable, $foreignTable, $foreignField); |
|
95 | + } |
|
96 | + |
|
97 | + $output[] = ''; |
|
98 | + return $output; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Convenience method for printing out relation. |
|
103 | + * |
|
104 | + * @param string $tableName |
|
105 | + * @param string $fieldName |
|
106 | + * @param string $relationType |
|
107 | + * @return array |
|
108 | + */ |
|
109 | + protected function checkRelationOf($tableName, $fieldName, $relationType) |
|
110 | + { |
|
111 | + $output = []; |
|
112 | + |
|
113 | + $table = Tca::table($tableName); |
|
114 | + $output[] = sprintf('* field: "%s", relation: %s', $fieldName, $relationType); |
|
115 | + |
|
116 | + $foreignTable = $table->field($fieldName)->getForeignTable(); |
|
117 | + $foreignField = $table->field($fieldName)->getForeignField(); |
|
118 | + $output[] = sprintf(' %s.%s <--> %s.%s', $tableName, $fieldName, $foreignTable, $foreignField); |
|
119 | + $output[] = ''; |
|
120 | + |
|
121 | + return $output; |
|
122 | + } |
|
123 | 123 | } |
@@ -21,80 +21,80 @@ |
||
21 | 21 | */ |
22 | 22 | class VisibilityRenderer extends ColumnRendererAbstract |
23 | 23 | { |
24 | - /** |
|
25 | - * Render visibility for the Grid. |
|
26 | - * |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function render() |
|
30 | - { |
|
31 | - $output = ''; |
|
32 | - $hiddenField = Tca::table()->getHiddenField(); |
|
24 | + /** |
|
25 | + * Render visibility for the Grid. |
|
26 | + * |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function render() |
|
30 | + { |
|
31 | + $output = ''; |
|
32 | + $hiddenField = Tca::table()->getHiddenField(); |
|
33 | 33 | |
34 | - if ($hiddenField) { |
|
35 | - $spriteName = $this->object[$hiddenField] ? 'actions-edit-unhide' : 'actions-edit-hide'; |
|
34 | + if ($hiddenField) { |
|
35 | + $spriteName = $this->object[$hiddenField] ? 'actions-edit-unhide' : 'actions-edit-hide'; |
|
36 | 36 | |
37 | - $label = $this->object[$hiddenField] ? 'unHide' : 'hide'; |
|
37 | + $label = $this->object[$hiddenField] ? 'unHide' : 'hide'; |
|
38 | 38 | |
39 | - $output = $this->makeLinkButton() |
|
40 | - ->setHref($this->getEditUri($this->object)) |
|
41 | - ->setClasses('btn-visibility-toggle') |
|
42 | - ->setDataAttributes([ |
|
43 | - 'toggle' => 'tooltip', |
|
44 | - ]) |
|
45 | - ->setTitle($this->getLabelService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:' . $label)) |
|
46 | - ->setIcon($this->getIconFactory()->getIcon($spriteName, Icon::SIZE_SMALL)) |
|
47 | - ->render(); |
|
48 | - } |
|
49 | - return $output; |
|
50 | - } |
|
39 | + $output = $this->makeLinkButton() |
|
40 | + ->setHref($this->getEditUri($this->object)) |
|
41 | + ->setClasses('btn-visibility-toggle') |
|
42 | + ->setDataAttributes([ |
|
43 | + 'toggle' => 'tooltip', |
|
44 | + ]) |
|
45 | + ->setTitle($this->getLabelService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:' . $label)) |
|
46 | + ->setIcon($this->getIconFactory()->getIcon($spriteName, Icon::SIZE_SMALL)) |
|
47 | + ->render(); |
|
48 | + } |
|
49 | + return $output; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param Content $object |
|
54 | - * @return string |
|
55 | - */ |
|
56 | - protected function getEditUri(Content $object) |
|
57 | - { |
|
58 | - $hiddenField = Tca::table()->getHiddenField(); |
|
52 | + /** |
|
53 | + * @param Content $object |
|
54 | + * @return string |
|
55 | + */ |
|
56 | + protected function getEditUri(Content $object) |
|
57 | + { |
|
58 | + $hiddenField = Tca::table()->getHiddenField(); |
|
59 | 59 | |
60 | - $additionalParameters = array( |
|
61 | - $this->getModuleLoader()->getParameterPrefix() => [ |
|
62 | - 'controller' => 'Content', |
|
63 | - 'action' => 'update', |
|
64 | - 'format' => 'json', |
|
65 | - 'fieldNameAndPath' => Tca::table()->getHiddenField(), |
|
66 | - 'matches' => [ |
|
67 | - 'uid' => $object->getUid(), |
|
68 | - ], |
|
69 | - 'content' => [$hiddenField => (int)!$this->object[$hiddenField]], |
|
70 | - ], |
|
71 | - ); |
|
60 | + $additionalParameters = array( |
|
61 | + $this->getModuleLoader()->getParameterPrefix() => [ |
|
62 | + 'controller' => 'Content', |
|
63 | + 'action' => 'update', |
|
64 | + 'format' => 'json', |
|
65 | + 'fieldNameAndPath' => Tca::table()->getHiddenField(), |
|
66 | + 'matches' => [ |
|
67 | + 'uid' => $object->getUid(), |
|
68 | + ], |
|
69 | + 'content' => [$hiddenField => (int)!$this->object[$hiddenField]], |
|
70 | + ], |
|
71 | + ); |
|
72 | 72 | |
73 | - return $this->getModuleLoader()->getModuleUrl($additionalParameters); |
|
74 | - } |
|
73 | + return $this->getModuleLoader()->getModuleUrl($additionalParameters); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @return LinkButton |
|
78 | - */ |
|
79 | - protected function makeLinkButton() |
|
80 | - { |
|
81 | - return GeneralUtility::makeInstance(LinkButton::class); |
|
82 | - } |
|
76 | + /** |
|
77 | + * @return LinkButton |
|
78 | + */ |
|
79 | + protected function makeLinkButton() |
|
80 | + { |
|
81 | + return GeneralUtility::makeInstance(LinkButton::class); |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * @return IconFactory |
|
87 | - */ |
|
88 | - protected function getIconFactory() |
|
89 | - { |
|
90 | - return GeneralUtility::makeInstance(IconFactory::class); |
|
91 | - } |
|
85 | + /** |
|
86 | + * @return IconFactory |
|
87 | + */ |
|
88 | + protected function getIconFactory() |
|
89 | + { |
|
90 | + return GeneralUtility::makeInstance(IconFactory::class); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * @return LanguageService |
|
95 | - */ |
|
96 | - protected function getLabelService() |
|
97 | - { |
|
98 | - return $GLOBALS['LANG']; |
|
99 | - } |
|
93 | + /** |
|
94 | + * @return LanguageService |
|
95 | + */ |
|
96 | + protected function getLabelService() |
|
97 | + { |
|
98 | + return $GLOBALS['LANG']; |
|
99 | + } |
|
100 | 100 | } |
@@ -15,45 +15,45 @@ |
||
15 | 15 | */ |
16 | 16 | interface ColumnRendererInterface |
17 | 17 | { |
18 | - /** |
|
19 | - * Render a column in the Grid. |
|
20 | - * |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function render(); |
|
24 | - |
|
25 | - /** |
|
26 | - * @param Content $object |
|
27 | - * @return $this |
|
28 | - */ |
|
29 | - public function setObject($object); |
|
30 | - |
|
31 | - /** |
|
32 | - * @param string $fieldName |
|
33 | - * @return $this |
|
34 | - */ |
|
35 | - public function setFieldName($fieldName); |
|
36 | - |
|
37 | - /** |
|
38 | - * @param int $index |
|
39 | - * @return $this |
|
40 | - */ |
|
41 | - public function setRowIndex($index); |
|
42 | - |
|
43 | - /** |
|
44 | - * @param array $configuration |
|
45 | - * @return $this |
|
46 | - */ |
|
47 | - public function setFieldConfiguration($configuration); |
|
48 | - |
|
49 | - /** |
|
50 | - * @param array $configuration |
|
51 | - * @return $this |
|
52 | - */ |
|
53 | - public function setGridRendererConfiguration($configuration); |
|
54 | - |
|
55 | - /** |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function getConfiguration(); |
|
18 | + /** |
|
19 | + * Render a column in the Grid. |
|
20 | + * |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function render(); |
|
24 | + |
|
25 | + /** |
|
26 | + * @param Content $object |
|
27 | + * @return $this |
|
28 | + */ |
|
29 | + public function setObject($object); |
|
30 | + |
|
31 | + /** |
|
32 | + * @param string $fieldName |
|
33 | + * @return $this |
|
34 | + */ |
|
35 | + public function setFieldName($fieldName); |
|
36 | + |
|
37 | + /** |
|
38 | + * @param int $index |
|
39 | + * @return $this |
|
40 | + */ |
|
41 | + public function setRowIndex($index); |
|
42 | + |
|
43 | + /** |
|
44 | + * @param array $configuration |
|
45 | + * @return $this |
|
46 | + */ |
|
47 | + public function setFieldConfiguration($configuration); |
|
48 | + |
|
49 | + /** |
|
50 | + * @param array $configuration |
|
51 | + * @return $this |
|
52 | + */ |
|
53 | + public function setGridRendererConfiguration($configuration); |
|
54 | + |
|
55 | + /** |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function getConfiguration(); |
|
59 | 59 | } |
@@ -16,40 +16,40 @@ |
||
16 | 16 | */ |
17 | 17 | class ButtonGroupRenderer extends ColumnRendererAbstract |
18 | 18 | { |
19 | - /** |
|
20 | - * Configure the "Button Group" Grid Renderer. |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - $configuration = array( |
|
25 | - 'sortable' => false, |
|
26 | - 'canBeHidden' => false, |
|
27 | - 'width' => '100px', |
|
28 | - ); |
|
29 | - parent::__construct($configuration); |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Render the "Button Group" in the Grid, e.g. edit, delete, etc.. |
|
34 | - * |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function render() |
|
38 | - { |
|
39 | - $components = $this->getModuleLoader()->getGridButtonsComponents(); |
|
40 | - |
|
41 | - $buttons = []; |
|
42 | - foreach ($components as $component) { |
|
43 | - /** @var $view */ |
|
44 | - $view = GeneralUtility::makeInstance($component); |
|
45 | - $buttons[] = $view->render($this->getObject()); |
|
46 | - } |
|
47 | - |
|
48 | - $output = sprintf( |
|
49 | - '<div class="btn-toolbar pull-right" role="toolbar" aria-label=""><div class="btn-group" role="group" aria-label="">%s</div></div>', |
|
50 | - implode("\n", $buttons) |
|
51 | - ); |
|
52 | - |
|
53 | - return $output; |
|
54 | - } |
|
19 | + /** |
|
20 | + * Configure the "Button Group" Grid Renderer. |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + $configuration = array( |
|
25 | + 'sortable' => false, |
|
26 | + 'canBeHidden' => false, |
|
27 | + 'width' => '100px', |
|
28 | + ); |
|
29 | + parent::__construct($configuration); |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Render the "Button Group" in the Grid, e.g. edit, delete, etc.. |
|
34 | + * |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function render() |
|
38 | + { |
|
39 | + $components = $this->getModuleLoader()->getGridButtonsComponents(); |
|
40 | + |
|
41 | + $buttons = []; |
|
42 | + foreach ($components as $component) { |
|
43 | + /** @var $view */ |
|
44 | + $view = GeneralUtility::makeInstance($component); |
|
45 | + $buttons[] = $view->render($this->getObject()); |
|
46 | + } |
|
47 | + |
|
48 | + $output = sprintf( |
|
49 | + '<div class="btn-toolbar pull-right" role="toolbar" aria-label=""><div class="btn-group" role="group" aria-label="">%s</div></div>', |
|
50 | + implode("\n", $buttons) |
|
51 | + ); |
|
52 | + |
|
53 | + return $output; |
|
54 | + } |
|
55 | 55 | } |
@@ -20,66 +20,66 @@ |
||
20 | 20 | */ |
21 | 21 | class RelationCountRenderer extends ColumnRendererAbstract |
22 | 22 | { |
23 | - /** |
|
24 | - * Render a representation of the relation on the GUI. |
|
25 | - * |
|
26 | - * @return string |
|
27 | - */ |
|
28 | - public function render() |
|
29 | - { |
|
30 | - $output = ''; |
|
31 | - if ($this->isBackendMode()) { |
|
32 | - $output = $this->renderForBackend(); |
|
33 | - } |
|
23 | + /** |
|
24 | + * Render a representation of the relation on the GUI. |
|
25 | + * |
|
26 | + * @return string |
|
27 | + */ |
|
28 | + public function render() |
|
29 | + { |
|
30 | + $output = ''; |
|
31 | + if ($this->isBackendMode()) { |
|
32 | + $output = $this->renderForBackend(); |
|
33 | + } |
|
34 | 34 | |
35 | - return $output; |
|
36 | - } |
|
35 | + return $output; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - protected function renderForBackend() |
|
42 | - { |
|
43 | - $numberOfObjects = count($this->object[$this->fieldName]); |
|
38 | + /** |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + protected function renderForBackend() |
|
42 | + { |
|
43 | + $numberOfObjects = count($this->object[$this->fieldName]); |
|
44 | 44 | |
45 | - if ($numberOfObjects > 1) { |
|
46 | - $label = 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:items'; |
|
47 | - if (isset($this->gridRendererConfiguration['labelPlural'])) { |
|
48 | - $label = $this->gridRendererConfiguration['labelPlural']; |
|
49 | - } |
|
50 | - } else { |
|
51 | - $label = 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:item'; |
|
52 | - if (isset($this->gridRendererConfiguration['labelSingular'])) { |
|
53 | - $label = $this->gridRendererConfiguration['labelSingular']; |
|
54 | - } |
|
55 | - } |
|
45 | + if ($numberOfObjects > 1) { |
|
46 | + $label = 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:items'; |
|
47 | + if (isset($this->gridRendererConfiguration['labelPlural'])) { |
|
48 | + $label = $this->gridRendererConfiguration['labelPlural']; |
|
49 | + } |
|
50 | + } else { |
|
51 | + $label = 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:item'; |
|
52 | + if (isset($this->gridRendererConfiguration['labelSingular'])) { |
|
53 | + $label = $this->gridRendererConfiguration['labelSingular']; |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - $template = '<a href="%s&returnUrl=%s&search=%s&query=%s:%s">%s %s<span class="invisible" style="padding-left: 5px">%s</span></a>'; |
|
57 | + $template = '<a href="%s&returnUrl=%s&search=%s&query=%s:%s">%s %s<span class="invisible" style="padding-left: 5px">%s</span></a>'; |
|
58 | 58 | |
59 | - $foreignField = Tca::table($this->object)->field($this->fieldName)->getForeignField(); |
|
60 | - $search = json_encode(array(array($foreignField => $this->object->getUid()))); |
|
59 | + $foreignField = Tca::table($this->object)->field($this->fieldName)->getForeignField(); |
|
60 | + $search = json_encode(array(array($foreignField => $this->object->getUid()))); |
|
61 | 61 | |
62 | - $moduleTarget = empty($this->gridRendererConfiguration['targetModule']) ? '' : $this->gridRendererConfiguration['targetModule']; |
|
63 | - return sprintf( |
|
64 | - $template, |
|
65 | - BackendUtility::getModuleUrl($moduleTarget), |
|
66 | - rawurlencode(BackendUtility::getModuleUrl($this->gridRendererConfiguration['sourceModule'])), |
|
67 | - rawurlencode($search), |
|
68 | - rawurlencode($foreignField), |
|
69 | - rawurlencode($this->object->getUid()), |
|
70 | - htmlspecialchars($numberOfObjects), |
|
71 | - htmlspecialchars(LocalizationUtility::translate($label, '')), |
|
72 | - $this->getIconFactory()->getIcon('extensions-vidi-go', Icon::SIZE_SMALL) |
|
73 | - ); |
|
74 | - } |
|
62 | + $moduleTarget = empty($this->gridRendererConfiguration['targetModule']) ? '' : $this->gridRendererConfiguration['targetModule']; |
|
63 | + return sprintf( |
|
64 | + $template, |
|
65 | + BackendUtility::getModuleUrl($moduleTarget), |
|
66 | + rawurlencode(BackendUtility::getModuleUrl($this->gridRendererConfiguration['sourceModule'])), |
|
67 | + rawurlencode($search), |
|
68 | + rawurlencode($foreignField), |
|
69 | + rawurlencode($this->object->getUid()), |
|
70 | + htmlspecialchars($numberOfObjects), |
|
71 | + htmlspecialchars(LocalizationUtility::translate($label, '')), |
|
72 | + $this->getIconFactory()->getIcon('extensions-vidi-go', Icon::SIZE_SMALL) |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Returns whether the current mode is Frontend |
|
78 | - * |
|
79 | - * @return bool |
|
80 | - */ |
|
81 | - protected function isBackendMode() |
|
82 | - { |
|
83 | - return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); |
|
84 | - } |
|
76 | + /** |
|
77 | + * Returns whether the current mode is Frontend |
|
78 | + * |
|
79 | + * @return bool |
|
80 | + */ |
|
81 | + protected function isBackendMode() |
|
82 | + { |
|
83 | + return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); |
|
84 | + } |
|
85 | 85 | } |
@@ -18,55 +18,55 @@ |
||
18 | 18 | */ |
19 | 19 | class RelationEditRenderer extends ColumnRendererAbstract |
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 | - { |
|
39 | - // Initialize url parameters array. |
|
40 | - $urlParameters = array( |
|
41 | - $this->getModuleLoader()->getParameterPrefix() => array( |
|
42 | - 'controller' => 'Content', |
|
43 | - 'action' => 'edit', |
|
44 | - 'matches' => array('uid' => $this->object->getUid()), |
|
45 | - 'fieldNameAndPath' => $this->getFieldName(), |
|
46 | - ), |
|
47 | - ); |
|
34 | + /** |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + protected function renderForBackend() |
|
38 | + { |
|
39 | + // Initialize url parameters array. |
|
40 | + $urlParameters = array( |
|
41 | + $this->getModuleLoader()->getParameterPrefix() => array( |
|
42 | + 'controller' => 'Content', |
|
43 | + 'action' => 'edit', |
|
44 | + 'matches' => array('uid' => $this->object->getUid()), |
|
45 | + 'fieldNameAndPath' => $this->getFieldName(), |
|
46 | + ), |
|
47 | + ); |
|
48 | 48 | |
49 | - $fieldLabel = Tca::table()->field($this->getFieldName())->getLabel(); |
|
50 | - if ($fieldLabel) { |
|
51 | - $fieldLabel = str_replace(':', '', $fieldLabel); // sanitize label |
|
52 | - } |
|
49 | + $fieldLabel = Tca::table()->field($this->getFieldName())->getLabel(); |
|
50 | + if ($fieldLabel) { |
|
51 | + $fieldLabel = str_replace(':', '', $fieldLabel); // sanitize label |
|
52 | + } |
|
53 | 53 | |
54 | - return sprintf( |
|
55 | - '<div style="text-align: right" class="pull-right invisible"><a href="%s" class="btn-edit-relation" data-field-label="%s">%s</a></div>', |
|
56 | - $this->getModuleLoader()->getModuleUrl($urlParameters), |
|
57 | - $fieldLabel, |
|
58 | - $this->getIconFactory()->getIcon('actions-add', Icon::SIZE_SMALL) |
|
59 | - ); |
|
60 | - } |
|
54 | + return sprintf( |
|
55 | + '<div style="text-align: right" class="pull-right invisible"><a href="%s" class="btn-edit-relation" data-field-label="%s">%s</a></div>', |
|
56 | + $this->getModuleLoader()->getModuleUrl($urlParameters), |
|
57 | + $fieldLabel, |
|
58 | + $this->getIconFactory()->getIcon('actions-add', Icon::SIZE_SMALL) |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Returns whether the current mode is Frontend |
|
64 | - * |
|
65 | - * @return bool |
|
66 | - */ |
|
67 | - protected function isBackendMode() |
|
68 | - { |
|
69 | - return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); |
|
70 | - ; |
|
71 | - } |
|
62 | + /** |
|
63 | + * Returns whether the current mode is Frontend |
|
64 | + * |
|
65 | + * @return bool |
|
66 | + */ |
|
67 | + protected function isBackendMode() |
|
68 | + { |
|
69 | + return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); |
|
70 | + ; |
|
71 | + } |
|
72 | 72 | } |
@@ -18,35 +18,35 @@ |
||
18 | 18 | */ |
19 | 19 | class CsvToArrayConverter extends AbstractTypeConverter |
20 | 20 | { |
21 | - /** |
|
22 | - * @var array<string> |
|
23 | - */ |
|
24 | - protected $sourceTypes = array('string'); |
|
21 | + /** |
|
22 | + * @var array<string> |
|
23 | + */ |
|
24 | + protected $sourceTypes = array('string'); |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - protected $targetType = 'array'; |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + protected $targetType = 'array'; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var integer |
|
33 | - */ |
|
34 | - protected $priority = 1; |
|
31 | + /** |
|
32 | + * @var integer |
|
33 | + */ |
|
34 | + protected $priority = 1; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Actually convert from $source to $targetType |
|
38 | - * |
|
39 | - * @param string $source |
|
40 | - * @param string $targetType |
|
41 | - * @param array $convertedChildProperties |
|
42 | - * @param PropertyMappingConfigurationInterface $configuration |
|
43 | - * @return array |
|
44 | - * @throws \Exception |
|
45 | - * @throws FileDoesNotExistException |
|
46 | - * @api |
|
47 | - */ |
|
48 | - public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) |
|
49 | - { |
|
50 | - return GeneralUtility::trimExplode(',', $source, true); |
|
51 | - } |
|
36 | + /** |
|
37 | + * Actually convert from $source to $targetType |
|
38 | + * |
|
39 | + * @param string $source |
|
40 | + * @param string $targetType |
|
41 | + * @param array $convertedChildProperties |
|
42 | + * @param PropertyMappingConfigurationInterface $configuration |
|
43 | + * @return array |
|
44 | + * @throws \Exception |
|
45 | + * @throws FileDoesNotExistException |
|
46 | + * @api |
|
47 | + */ |
|
48 | + public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) |
|
49 | + { |
|
50 | + return GeneralUtility::trimExplode(',', $source, true); |
|
51 | + } |
|
52 | 52 | } |
@@ -18,42 +18,42 @@ |
||
18 | 18 | */ |
19 | 19 | class GpViewHelper extends AbstractViewHelper |
20 | 20 | { |
21 | - /** |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function initializeArguments() |
|
25 | - { |
|
26 | - $this->registerArgument('argument', 'string', 'The argument name', true); |
|
27 | - $this->registerArgument('encode', 'bool', 'Whether to encode the URL.', false, true); |
|
28 | - } |
|
29 | - |
|
30 | - /** |
|
31 | - * Tells whether the argument exists or not. |
|
32 | - * |
|
33 | - * @return boolean |
|
34 | - */ |
|
35 | - public function render() |
|
36 | - { |
|
37 | - $value = ''; // default value |
|
38 | - |
|
39 | - // Merge parameters |
|
40 | - $parameters = GeneralUtility::_GET(); |
|
41 | - $post = GeneralUtility::_POST(); |
|
42 | - ArrayUtility::mergeRecursiveWithOverrule($parameters, $post); |
|
43 | - |
|
44 | - // Traverse argument parts and retrieve value. |
|
45 | - $argumentParts = GeneralUtility::trimExplode('|', $this->arguments['argument']); |
|
46 | - foreach ($argumentParts as $argumentPart) { |
|
47 | - if (isset($parameters[$argumentPart])) { |
|
48 | - $value = $parameters[$argumentPart]; |
|
49 | - $parameters = $value; |
|
50 | - } |
|
51 | - } |
|
52 | - |
|
53 | - // Possible url encode. |
|
54 | - if ($this->arguments['encode']) { |
|
55 | - $value = urlencode($value); |
|
56 | - } |
|
57 | - return $value; |
|
58 | - } |
|
21 | + /** |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function initializeArguments() |
|
25 | + { |
|
26 | + $this->registerArgument('argument', 'string', 'The argument name', true); |
|
27 | + $this->registerArgument('encode', 'bool', 'Whether to encode the URL.', false, true); |
|
28 | + } |
|
29 | + |
|
30 | + /** |
|
31 | + * Tells whether the argument exists or not. |
|
32 | + * |
|
33 | + * @return boolean |
|
34 | + */ |
|
35 | + public function render() |
|
36 | + { |
|
37 | + $value = ''; // default value |
|
38 | + |
|
39 | + // Merge parameters |
|
40 | + $parameters = GeneralUtility::_GET(); |
|
41 | + $post = GeneralUtility::_POST(); |
|
42 | + ArrayUtility::mergeRecursiveWithOverrule($parameters, $post); |
|
43 | + |
|
44 | + // Traverse argument parts and retrieve value. |
|
45 | + $argumentParts = GeneralUtility::trimExplode('|', $this->arguments['argument']); |
|
46 | + foreach ($argumentParts as $argumentPart) { |
|
47 | + if (isset($parameters[$argumentPart])) { |
|
48 | + $value = $parameters[$argumentPart]; |
|
49 | + $parameters = $value; |
|
50 | + } |
|
51 | + } |
|
52 | + |
|
53 | + // Possible url encode. |
|
54 | + if ($this->arguments['encode']) { |
|
55 | + $value = urlencode($value); |
|
56 | + } |
|
57 | + return $value; |
|
58 | + } |
|
59 | 59 | } |
@@ -18,25 +18,25 @@ |
||
18 | 18 | */ |
19 | 19 | class ModuleLoaderViewHelper extends AbstractViewHelper |
20 | 20 | { |
21 | - /** |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function initializeArguments() |
|
25 | - { |
|
26 | - $this->registerArgument('key', 'string', 'The module key', true); |
|
27 | - } |
|
21 | + /** |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function initializeArguments() |
|
25 | + { |
|
26 | + $this->registerArgument('key', 'string', 'The module key', true); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Interface with the Module Loader. |
|
31 | - * |
|
32 | - * @return string |
|
33 | - */ |
|
34 | - public function render() |
|
35 | - { |
|
36 | - $getter = 'get' . ucfirst($this->arguments['key']); |
|
29 | + /** |
|
30 | + * Interface with the Module Loader. |
|
31 | + * |
|
32 | + * @return string |
|
33 | + */ |
|
34 | + public function render() |
|
35 | + { |
|
36 | + $getter = 'get' . ucfirst($this->arguments['key']); |
|
37 | 37 | |
38 | - /** @var ModuleLoader $moduleLoader */ |
|
39 | - $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
40 | - return $moduleLoader->$getter(); |
|
41 | - } |
|
38 | + /** @var ModuleLoader $moduleLoader */ |
|
39 | + $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
40 | + return $moduleLoader->$getter(); |
|
41 | + } |
|
42 | 42 | } |