@@ -14,31 +14,31 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class CheckBoxRenderer extends ColumnRendererAbstract |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Configure the "Check Box" Grid Renderer. |
|
| 19 | - */ |
|
| 20 | - public function __construct() |
|
| 21 | - { |
|
| 22 | - $configuration = array( |
|
| 23 | - 'width' => '5px', |
|
| 24 | - 'sortable' => false, |
|
| 25 | - 'canBeHidden' => false, |
|
| 26 | - 'html' => '<input type="checkbox" class="checkbox-row-top"/>', |
|
| 27 | - ); |
|
| 28 | - parent::__construct($configuration); |
|
| 29 | - } |
|
| 17 | + /** |
|
| 18 | + * Configure the "Check Box" Grid Renderer. |
|
| 19 | + */ |
|
| 20 | + public function __construct() |
|
| 21 | + { |
|
| 22 | + $configuration = array( |
|
| 23 | + 'width' => '5px', |
|
| 24 | + 'sortable' => false, |
|
| 25 | + 'canBeHidden' => false, |
|
| 26 | + 'html' => '<input type="checkbox" class="checkbox-row-top"/>', |
|
| 27 | + ); |
|
| 28 | + parent::__construct($configuration); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Render the "Check Box" in the Grid. |
|
| 33 | - * |
|
| 34 | - * @return string |
|
| 35 | - */ |
|
| 36 | - public function render() |
|
| 37 | - { |
|
| 38 | - return sprintf( |
|
| 39 | - '<input type="checkbox" class="checkbox-row" data-index="%s" data-uid="%s"/>', |
|
| 40 | - $this->getRowIndex(), |
|
| 41 | - $this->getObject()->getUid() |
|
| 42 | - ); |
|
| 43 | - } |
|
| 31 | + /** |
|
| 32 | + * Render the "Check Box" in the Grid. |
|
| 33 | + * |
|
| 34 | + * @return string |
|
| 35 | + */ |
|
| 36 | + public function render() |
|
| 37 | + { |
|
| 38 | + return sprintf( |
|
| 39 | + '<input type="checkbox" class="checkbox-row" data-index="%s" data-uid="%s"/>', |
|
| 40 | + $this->getRowIndex(), |
|
| 41 | + $this->getObject()->getUid() |
|
| 42 | + ); |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -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 | } |
@@ -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 | } |
@@ -19,29 +19,29 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class SpriteViewHelper extends AbstractViewHelper |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @return void |
|
| 24 | - */ |
|
| 25 | - public function initializeArguments() |
|
| 26 | - { |
|
| 27 | - $this->registerArgument('name', 'string', 'the file to include', true); |
|
| 28 | - } |
|
| 22 | + /** |
|
| 23 | + * @return void |
|
| 24 | + */ |
|
| 25 | + public function initializeArguments() |
|
| 26 | + { |
|
| 27 | + $this->registerArgument('name', 'string', 'the file to include', true); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Returns an icon using sprites |
|
| 32 | - * |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public function render() |
|
| 36 | - { |
|
| 37 | - return $this->getIconFactory()->getIcon($this->arguments['name'], Icon::SIZE_SMALL); |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Returns an icon using sprites |
|
| 32 | + * |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public function render() |
|
| 36 | + { |
|
| 37 | + return $this->getIconFactory()->getIcon($this->arguments['name'], Icon::SIZE_SMALL); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return IconFactory|object |
|
| 42 | - */ |
|
| 43 | - protected function getIconFactory() |
|
| 44 | - { |
|
| 45 | - return GeneralUtility::makeInstance(IconFactory::class); |
|
| 46 | - } |
|
| 40 | + /** |
|
| 41 | + * @return IconFactory|object |
|
| 42 | + */ |
|
| 43 | + protected function getIconFactory() |
|
| 44 | + { |
|
| 45 | + return GeneralUtility::makeInstance(IconFactory::class); |
|
| 46 | + } |
|
| 47 | 47 | } |