@@ -25,161 +25,161 @@ |
||
| 25 | 25 | class RelationRenderer extends ColumnRendererAbstract |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Render a representation of the relation on the GUI. |
|
| 30 | - * |
|
| 31 | - * @return string |
|
| 32 | - */ |
|
| 33 | - public function render() |
|
| 34 | - { |
|
| 35 | - if ($this->isBackendMode()) { |
|
| 36 | - $output = $this->renderForBackend(); |
|
| 37 | - } else { |
|
| 38 | - $output = $this->renderForFrontend(); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - return $output; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @return string |
|
| 46 | - */ |
|
| 47 | - protected function renderForBackend() |
|
| 48 | - { |
|
| 49 | - |
|
| 50 | - $output = ''; |
|
| 51 | - |
|
| 52 | - // Get label of the foreign table. |
|
| 53 | - $foreignLabelField = $this->getForeignTableLabelField($this->fieldName); |
|
| 54 | - |
|
| 55 | - if (Tca::table($this->object)->field($this->fieldName)->hasOne()) { |
|
| 56 | - |
|
| 57 | - $foreignObject = $this->object[$this->fieldName]; |
|
| 58 | - |
|
| 59 | - if ($foreignObject) { |
|
| 60 | - $output = sprintf( |
|
| 61 | - '<a href="%s" data-uid="%s" class="btn-edit invisible">%s</a> <span>%s</span>', |
|
| 62 | - $this->getEditUri($foreignObject), |
|
| 63 | - $this->object->getUid(), |
|
| 64 | - $this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL), |
|
| 65 | - $foreignObject[$foreignLabelField] |
|
| 66 | - ); |
|
| 67 | - } |
|
| 68 | - } elseif (Tca::table($this->object)->field($this->fieldName)->hasMany()) { |
|
| 69 | - |
|
| 70 | - if (!empty($this->object[$this->fieldName])) { |
|
| 71 | - |
|
| 72 | - /** @var $foreignObject \Fab\Vidi\Domain\Model\Content */ |
|
| 73 | - foreach ($this->object[$this->fieldName] as $foreignObject) { |
|
| 74 | - $output .= sprintf( |
|
| 75 | - '<li><a href="%s" data-uid="%s" class="btn-edit invisible">%s</a> <span>%s</span></li>', |
|
| 76 | - $this->getEditUri($foreignObject), |
|
| 77 | - $this->object->getUid(), |
|
| 78 | - $this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL), |
|
| 79 | - $foreignObject[$foreignLabelField] |
|
| 80 | - ); |
|
| 81 | - } |
|
| 82 | - $output = sprintf('<ul class="list-unstyled">%s</ul>', $output); |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - return $output; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - protected function renderForFrontend() |
|
| 92 | - { |
|
| 93 | - |
|
| 94 | - $output = ''; |
|
| 95 | - |
|
| 96 | - // Get label of the foreign table. |
|
| 97 | - $foreignLabelField = $this->getForeignTableLabelField($this->fieldName); |
|
| 98 | - |
|
| 99 | - if (Tca::table($this->object)->field($this->fieldName)->hasOne()) { |
|
| 100 | - |
|
| 101 | - $foreignObject = $this->object[$this->fieldName]; |
|
| 102 | - |
|
| 103 | - if ($foreignObject) { |
|
| 104 | - $output = sprintf( |
|
| 105 | - '%s', |
|
| 106 | - $foreignObject[$foreignLabelField] |
|
| 107 | - ); |
|
| 108 | - } |
|
| 109 | - } elseif (Tca::table($this->object)->field($this->fieldName)->hasMany()) { |
|
| 110 | - |
|
| 111 | - if (!empty($this->object[$this->fieldName])) { |
|
| 112 | - |
|
| 113 | - /** @var $foreignObject \Fab\Vidi\Domain\Model\Content */ |
|
| 114 | - foreach ($this->object[$this->fieldName] as $foreignObject) { |
|
| 115 | - $output .= sprintf( |
|
| 116 | - '<li>%s</li>', |
|
| 117 | - $foreignObject[$foreignLabelField] |
|
| 118 | - ); |
|
| 119 | - } |
|
| 120 | - $output = sprintf('<ul class="list-unstyled">%s</ul>', $output); |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - return $output; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Render an edit URI given an object. |
|
| 128 | - * |
|
| 129 | - * @param Content $object |
|
| 130 | - * @return string |
|
| 131 | - */ |
|
| 132 | - protected function getEditUri(Content $object) |
|
| 133 | - { |
|
| 134 | - $uri = BackendUtility::getModuleUrl( |
|
| 135 | - 'record_edit', |
|
| 136 | - array( |
|
| 137 | - $this->getEditParameterName($object) => 'edit', |
|
| 138 | - 'returnUrl' => $this->getModuleLoader()->getModuleUrl() |
|
| 139 | - ) |
|
| 140 | - ); |
|
| 141 | - return $uri; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * @param Content $object |
|
| 146 | - * @return string |
|
| 147 | - */ |
|
| 148 | - protected function getEditParameterName(Content $object) |
|
| 149 | - { |
|
| 150 | - return sprintf( |
|
| 151 | - 'edit[%s][%s]', |
|
| 152 | - $object->getDataType(), |
|
| 153 | - $object->getUid() |
|
| 154 | - ); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * Return the label field of the foreign table. |
|
| 160 | - * |
|
| 161 | - * @param string $fieldName |
|
| 162 | - * @return string |
|
| 163 | - */ |
|
| 164 | - protected function getForeignTableLabelField($fieldName) |
|
| 165 | - { |
|
| 166 | - |
|
| 167 | - // Get TCA table service. |
|
| 168 | - $table = Tca::table($this->object); |
|
| 169 | - |
|
| 170 | - // Compute the label of the foreign table. |
|
| 171 | - $relationDataType = $table->field($fieldName)->relationDataType(); |
|
| 172 | - return Tca::table($relationDataType)->getLabelField(); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * Returns whether the current mode is Frontend |
|
| 177 | - * |
|
| 178 | - * @return bool |
|
| 179 | - */ |
|
| 180 | - protected function isBackendMode() |
|
| 181 | - { |
|
| 182 | - return TYPO3_MODE === 'BE'; |
|
| 183 | - } |
|
| 28 | + /** |
|
| 29 | + * Render a representation of the relation on the GUI. |
|
| 30 | + * |
|
| 31 | + * @return string |
|
| 32 | + */ |
|
| 33 | + public function render() |
|
| 34 | + { |
|
| 35 | + if ($this->isBackendMode()) { |
|
| 36 | + $output = $this->renderForBackend(); |
|
| 37 | + } else { |
|
| 38 | + $output = $this->renderForFrontend(); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + return $output; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @return string |
|
| 46 | + */ |
|
| 47 | + protected function renderForBackend() |
|
| 48 | + { |
|
| 49 | + |
|
| 50 | + $output = ''; |
|
| 51 | + |
|
| 52 | + // Get label of the foreign table. |
|
| 53 | + $foreignLabelField = $this->getForeignTableLabelField($this->fieldName); |
|
| 54 | + |
|
| 55 | + if (Tca::table($this->object)->field($this->fieldName)->hasOne()) { |
|
| 56 | + |
|
| 57 | + $foreignObject = $this->object[$this->fieldName]; |
|
| 58 | + |
|
| 59 | + if ($foreignObject) { |
|
| 60 | + $output = sprintf( |
|
| 61 | + '<a href="%s" data-uid="%s" class="btn-edit invisible">%s</a> <span>%s</span>', |
|
| 62 | + $this->getEditUri($foreignObject), |
|
| 63 | + $this->object->getUid(), |
|
| 64 | + $this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL), |
|
| 65 | + $foreignObject[$foreignLabelField] |
|
| 66 | + ); |
|
| 67 | + } |
|
| 68 | + } elseif (Tca::table($this->object)->field($this->fieldName)->hasMany()) { |
|
| 69 | + |
|
| 70 | + if (!empty($this->object[$this->fieldName])) { |
|
| 71 | + |
|
| 72 | + /** @var $foreignObject \Fab\Vidi\Domain\Model\Content */ |
|
| 73 | + foreach ($this->object[$this->fieldName] as $foreignObject) { |
|
| 74 | + $output .= sprintf( |
|
| 75 | + '<li><a href="%s" data-uid="%s" class="btn-edit invisible">%s</a> <span>%s</span></li>', |
|
| 76 | + $this->getEditUri($foreignObject), |
|
| 77 | + $this->object->getUid(), |
|
| 78 | + $this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL), |
|
| 79 | + $foreignObject[$foreignLabelField] |
|
| 80 | + ); |
|
| 81 | + } |
|
| 82 | + $output = sprintf('<ul class="list-unstyled">%s</ul>', $output); |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + return $output; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + protected function renderForFrontend() |
|
| 92 | + { |
|
| 93 | + |
|
| 94 | + $output = ''; |
|
| 95 | + |
|
| 96 | + // Get label of the foreign table. |
|
| 97 | + $foreignLabelField = $this->getForeignTableLabelField($this->fieldName); |
|
| 98 | + |
|
| 99 | + if (Tca::table($this->object)->field($this->fieldName)->hasOne()) { |
|
| 100 | + |
|
| 101 | + $foreignObject = $this->object[$this->fieldName]; |
|
| 102 | + |
|
| 103 | + if ($foreignObject) { |
|
| 104 | + $output = sprintf( |
|
| 105 | + '%s', |
|
| 106 | + $foreignObject[$foreignLabelField] |
|
| 107 | + ); |
|
| 108 | + } |
|
| 109 | + } elseif (Tca::table($this->object)->field($this->fieldName)->hasMany()) { |
|
| 110 | + |
|
| 111 | + if (!empty($this->object[$this->fieldName])) { |
|
| 112 | + |
|
| 113 | + /** @var $foreignObject \Fab\Vidi\Domain\Model\Content */ |
|
| 114 | + foreach ($this->object[$this->fieldName] as $foreignObject) { |
|
| 115 | + $output .= sprintf( |
|
| 116 | + '<li>%s</li>', |
|
| 117 | + $foreignObject[$foreignLabelField] |
|
| 118 | + ); |
|
| 119 | + } |
|
| 120 | + $output = sprintf('<ul class="list-unstyled">%s</ul>', $output); |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + return $output; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Render an edit URI given an object. |
|
| 128 | + * |
|
| 129 | + * @param Content $object |
|
| 130 | + * @return string |
|
| 131 | + */ |
|
| 132 | + protected function getEditUri(Content $object) |
|
| 133 | + { |
|
| 134 | + $uri = BackendUtility::getModuleUrl( |
|
| 135 | + 'record_edit', |
|
| 136 | + array( |
|
| 137 | + $this->getEditParameterName($object) => 'edit', |
|
| 138 | + 'returnUrl' => $this->getModuleLoader()->getModuleUrl() |
|
| 139 | + ) |
|
| 140 | + ); |
|
| 141 | + return $uri; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * @param Content $object |
|
| 146 | + * @return string |
|
| 147 | + */ |
|
| 148 | + protected function getEditParameterName(Content $object) |
|
| 149 | + { |
|
| 150 | + return sprintf( |
|
| 151 | + 'edit[%s][%s]', |
|
| 152 | + $object->getDataType(), |
|
| 153 | + $object->getUid() |
|
| 154 | + ); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * Return the label field of the foreign table. |
|
| 160 | + * |
|
| 161 | + * @param string $fieldName |
|
| 162 | + * @return string |
|
| 163 | + */ |
|
| 164 | + protected function getForeignTableLabelField($fieldName) |
|
| 165 | + { |
|
| 166 | + |
|
| 167 | + // Get TCA table service. |
|
| 168 | + $table = Tca::table($this->object); |
|
| 169 | + |
|
| 170 | + // Compute the label of the foreign table. |
|
| 171 | + $relationDataType = $table->field($fieldName)->relationDataType(); |
|
| 172 | + return Tca::table($relationDataType)->getLabelField(); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * Returns whether the current mode is Frontend |
|
| 177 | + * |
|
| 178 | + * @return bool |
|
| 179 | + */ |
|
| 180 | + protected function isBackendMode() |
|
| 181 | + { |
|
| 182 | + return TYPO3_MODE === 'BE'; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | } |
@@ -26,68 +26,68 @@ |
||
| 26 | 26 | class RelationCountRenderer extends ColumnRendererAbstract |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Render a representation of the relation on the GUI. |
|
| 31 | - * |
|
| 32 | - * @return string |
|
| 33 | - */ |
|
| 34 | - public function render() |
|
| 35 | - { |
|
| 29 | + /** |
|
| 30 | + * Render a representation of the relation on the GUI. |
|
| 31 | + * |
|
| 32 | + * @return string |
|
| 33 | + */ |
|
| 34 | + public function render() |
|
| 35 | + { |
|
| 36 | 36 | |
| 37 | - $output = ''; |
|
| 38 | - if ($this->isBackendMode()) { |
|
| 39 | - $output = $this->renderForBackend(); |
|
| 40 | - } |
|
| 37 | + $output = ''; |
|
| 38 | + if ($this->isBackendMode()) { |
|
| 39 | + $output = $this->renderForBackend(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - return $output; |
|
| 43 | - } |
|
| 42 | + return $output; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @return string |
|
| 47 | - */ |
|
| 48 | - protected function renderForBackend() |
|
| 49 | - { |
|
| 45 | + /** |
|
| 46 | + * @return string |
|
| 47 | + */ |
|
| 48 | + protected function renderForBackend() |
|
| 49 | + { |
|
| 50 | 50 | |
| 51 | - $numberOfObjects = count($this->object[$this->fieldName]); |
|
| 51 | + $numberOfObjects = count($this->object[$this->fieldName]); |
|
| 52 | 52 | |
| 53 | - if ($numberOfObjects > 1) { |
|
| 54 | - $label = 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:items'; |
|
| 55 | - if (isset($this->gridRendererConfiguration['labelPlural'])) { |
|
| 56 | - $label = $this->gridRendererConfiguration['labelPlural']; |
|
| 57 | - } |
|
| 58 | - } else { |
|
| 59 | - $label = 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:item'; |
|
| 60 | - if (isset($this->gridRendererConfiguration['labelSingular'])) { |
|
| 61 | - $label = $this->gridRendererConfiguration['labelSingular']; |
|
| 62 | - } |
|
| 63 | - } |
|
| 53 | + if ($numberOfObjects > 1) { |
|
| 54 | + $label = 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:items'; |
|
| 55 | + if (isset($this->gridRendererConfiguration['labelPlural'])) { |
|
| 56 | + $label = $this->gridRendererConfiguration['labelPlural']; |
|
| 57 | + } |
|
| 58 | + } else { |
|
| 59 | + $label = 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:item'; |
|
| 60 | + if (isset($this->gridRendererConfiguration['labelSingular'])) { |
|
| 61 | + $label = $this->gridRendererConfiguration['labelSingular']; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - $template = '<a href="%s&returnUrl=%s&search=%s&query=%s:%s">%s %s<span class="invisible" style="padding-left: 5px">%s</span></a>'; |
|
| 65 | + $template = '<a href="%s&returnUrl=%s&search=%s&query=%s:%s">%s %s<span class="invisible" style="padding-left: 5px">%s</span></a>'; |
|
| 66 | 66 | |
| 67 | - $foreignField = Tca::table($this->object)->field($this->fieldName)->getForeignField(); |
|
| 68 | - $search = json_encode(array(array($foreignField => $this->object->getUid()))); |
|
| 67 | + $foreignField = Tca::table($this->object)->field($this->fieldName)->getForeignField(); |
|
| 68 | + $search = json_encode(array(array($foreignField => $this->object->getUid()))); |
|
| 69 | 69 | |
| 70 | - $moduleTarget = empty($this->gridRendererConfiguration['targetModule']) ? '' : $this->gridRendererConfiguration['targetModule']; |
|
| 71 | - return sprintf($template, |
|
| 72 | - BackendUtility::getModuleUrl($moduleTarget), |
|
| 73 | - rawurlencode(BackendUtility::getModuleUrl($this->gridRendererConfiguration['sourceModule'])), |
|
| 74 | - rawurlencode($search), |
|
| 75 | - rawurlencode($foreignField), |
|
| 76 | - rawurlencode($this->object->getUid()), |
|
| 77 | - htmlspecialchars($numberOfObjects), |
|
| 78 | - htmlspecialchars(LocalizationUtility::translate($label, '')), |
|
| 79 | - $this->getIconFactory()->getIcon('extensions-vidi-go', Icon::SIZE_SMALL) |
|
| 80 | - ); |
|
| 81 | - } |
|
| 70 | + $moduleTarget = empty($this->gridRendererConfiguration['targetModule']) ? '' : $this->gridRendererConfiguration['targetModule']; |
|
| 71 | + return sprintf($template, |
|
| 72 | + BackendUtility::getModuleUrl($moduleTarget), |
|
| 73 | + rawurlencode(BackendUtility::getModuleUrl($this->gridRendererConfiguration['sourceModule'])), |
|
| 74 | + rawurlencode($search), |
|
| 75 | + rawurlencode($foreignField), |
|
| 76 | + rawurlencode($this->object->getUid()), |
|
| 77 | + htmlspecialchars($numberOfObjects), |
|
| 78 | + htmlspecialchars(LocalizationUtility::translate($label, '')), |
|
| 79 | + $this->getIconFactory()->getIcon('extensions-vidi-go', Icon::SIZE_SMALL) |
|
| 80 | + ); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Returns whether the current mode is Frontend |
|
| 85 | - * |
|
| 86 | - * @return bool |
|
| 87 | - */ |
|
| 88 | - protected function isBackendMode() |
|
| 89 | - { |
|
| 90 | - return TYPO3_MODE === 'BE'; |
|
| 91 | - } |
|
| 83 | + /** |
|
| 84 | + * Returns whether the current mode is Frontend |
|
| 85 | + * |
|
| 86 | + * @return bool |
|
| 87 | + */ |
|
| 88 | + protected function isBackendMode() |
|
| 89 | + { |
|
| 90 | + return TYPO3_MODE === 'BE'; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | } |
@@ -25,175 +25,175 @@ |
||
| 25 | 25 | abstract class ColumnRendererAbstract implements ColumnRendererInterface |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * The content object. |
|
| 30 | - * |
|
| 31 | - * @var \Fab\Vidi\Domain\Model\Content |
|
| 32 | - */ |
|
| 33 | - protected $object; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 38 | - protected $fieldName; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var int |
|
| 42 | - */ |
|
| 43 | - protected $rowIndex; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var array |
|
| 47 | - */ |
|
| 48 | - protected $fieldConfiguration = array(); |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var array |
|
| 52 | - */ |
|
| 53 | - protected $gridRendererConfiguration = array(); |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @var array |
|
| 57 | - */ |
|
| 58 | - protected $configuration = array(); |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Constructor of a Generic component in Vidi. |
|
| 62 | - * |
|
| 63 | - * @param array $configuration |
|
| 64 | - * @param array $legacyParameterConfiguration |
|
| 65 | - */ |
|
| 66 | - public function __construct($configuration = array(), $legacyParameterConfiguration = array()) |
|
| 67 | - { |
|
| 68 | - if (is_string($configuration)) { |
|
| 69 | - $configuration = $legacyParameterConfiguration; |
|
| 70 | - GeneralUtility::deprecationLog('ColumnRendererAbstract: first parameter must now be an array. Please edit me in ' . get_class($this)); |
|
| 71 | - } |
|
| 72 | - $this->configuration = $configuration; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * @return array |
|
| 77 | - */ |
|
| 78 | - public function getConfiguration() |
|
| 79 | - { |
|
| 80 | - return $this->configuration; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * @return \Fab\Vidi\Domain\Model\Content |
|
| 85 | - */ |
|
| 86 | - public function getObject() |
|
| 87 | - { |
|
| 88 | - return $this->object; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * @param \Fab\Vidi\Domain\Model\Content $object |
|
| 93 | - * @return $this |
|
| 94 | - */ |
|
| 95 | - public function setObject($object) |
|
| 96 | - { |
|
| 97 | - $this->object = $object; |
|
| 98 | - return $this; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * @return string |
|
| 103 | - */ |
|
| 104 | - public function getFieldName() |
|
| 105 | - { |
|
| 106 | - return $this->fieldName; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * @param string $fieldName |
|
| 111 | - * @return $this |
|
| 112 | - */ |
|
| 113 | - public function setFieldName($fieldName) |
|
| 114 | - { |
|
| 115 | - $this->fieldName = $fieldName; |
|
| 116 | - return $this; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * @return int |
|
| 121 | - */ |
|
| 122 | - public function getRowIndex() |
|
| 123 | - { |
|
| 124 | - return $this->rowIndex; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * @param int $rowIndex |
|
| 129 | - * @return $this |
|
| 130 | - */ |
|
| 131 | - public function setRowIndex($rowIndex) |
|
| 132 | - { |
|
| 133 | - $this->rowIndex = $rowIndex; |
|
| 134 | - return $this; |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * @return array |
|
| 139 | - */ |
|
| 140 | - public function getFieldConfiguration() |
|
| 141 | - { |
|
| 142 | - return $this->fieldConfiguration; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * @param array $fieldConfiguration |
|
| 147 | - * @return $this |
|
| 148 | - */ |
|
| 149 | - public function setFieldConfiguration($fieldConfiguration) |
|
| 150 | - { |
|
| 151 | - $this->fieldConfiguration = $fieldConfiguration; |
|
| 152 | - return $this; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * @return array |
|
| 157 | - */ |
|
| 158 | - public function getGridRendererConfiguration() |
|
| 159 | - { |
|
| 160 | - return $this->gridRendererConfiguration; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * @param array $gridRendererConfiguration |
|
| 165 | - * @return $this |
|
| 166 | - */ |
|
| 167 | - public function setGridRendererConfiguration($gridRendererConfiguration) |
|
| 168 | - { |
|
| 169 | - $this->gridRendererConfiguration = $gridRendererConfiguration; |
|
| 170 | - return $this; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Get the Vidi Module Loader. |
|
| 175 | - * |
|
| 176 | - * @return ModuleLoader |
|
| 177 | - */ |
|
| 178 | - protected function getModuleLoader() |
|
| 179 | - { |
|
| 180 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * @return IconFactory |
|
| 185 | - */ |
|
| 186 | - protected function getIconFactory() |
|
| 187 | - { |
|
| 188 | - return GeneralUtility::makeInstance(IconFactory::class); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * @return LanguageService |
|
| 193 | - */ |
|
| 194 | - protected function getLanguageService() |
|
| 195 | - { |
|
| 196 | - return GeneralUtility::makeInstance(LanguageService::class); |
|
| 197 | - } |
|
| 28 | + /** |
|
| 29 | + * The content object. |
|
| 30 | + * |
|
| 31 | + * @var \Fab\Vidi\Domain\Model\Content |
|
| 32 | + */ |
|
| 33 | + protected $object; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | + protected $fieldName; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var int |
|
| 42 | + */ |
|
| 43 | + protected $rowIndex; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var array |
|
| 47 | + */ |
|
| 48 | + protected $fieldConfiguration = array(); |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var array |
|
| 52 | + */ |
|
| 53 | + protected $gridRendererConfiguration = array(); |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @var array |
|
| 57 | + */ |
|
| 58 | + protected $configuration = array(); |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Constructor of a Generic component in Vidi. |
|
| 62 | + * |
|
| 63 | + * @param array $configuration |
|
| 64 | + * @param array $legacyParameterConfiguration |
|
| 65 | + */ |
|
| 66 | + public function __construct($configuration = array(), $legacyParameterConfiguration = array()) |
|
| 67 | + { |
|
| 68 | + if (is_string($configuration)) { |
|
| 69 | + $configuration = $legacyParameterConfiguration; |
|
| 70 | + GeneralUtility::deprecationLog('ColumnRendererAbstract: first parameter must now be an array. Please edit me in ' . get_class($this)); |
|
| 71 | + } |
|
| 72 | + $this->configuration = $configuration; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * @return array |
|
| 77 | + */ |
|
| 78 | + public function getConfiguration() |
|
| 79 | + { |
|
| 80 | + return $this->configuration; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * @return \Fab\Vidi\Domain\Model\Content |
|
| 85 | + */ |
|
| 86 | + public function getObject() |
|
| 87 | + { |
|
| 88 | + return $this->object; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * @param \Fab\Vidi\Domain\Model\Content $object |
|
| 93 | + * @return $this |
|
| 94 | + */ |
|
| 95 | + public function setObject($object) |
|
| 96 | + { |
|
| 97 | + $this->object = $object; |
|
| 98 | + return $this; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * @return string |
|
| 103 | + */ |
|
| 104 | + public function getFieldName() |
|
| 105 | + { |
|
| 106 | + return $this->fieldName; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @param string $fieldName |
|
| 111 | + * @return $this |
|
| 112 | + */ |
|
| 113 | + public function setFieldName($fieldName) |
|
| 114 | + { |
|
| 115 | + $this->fieldName = $fieldName; |
|
| 116 | + return $this; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @return int |
|
| 121 | + */ |
|
| 122 | + public function getRowIndex() |
|
| 123 | + { |
|
| 124 | + return $this->rowIndex; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * @param int $rowIndex |
|
| 129 | + * @return $this |
|
| 130 | + */ |
|
| 131 | + public function setRowIndex($rowIndex) |
|
| 132 | + { |
|
| 133 | + $this->rowIndex = $rowIndex; |
|
| 134 | + return $this; |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * @return array |
|
| 139 | + */ |
|
| 140 | + public function getFieldConfiguration() |
|
| 141 | + { |
|
| 142 | + return $this->fieldConfiguration; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * @param array $fieldConfiguration |
|
| 147 | + * @return $this |
|
| 148 | + */ |
|
| 149 | + public function setFieldConfiguration($fieldConfiguration) |
|
| 150 | + { |
|
| 151 | + $this->fieldConfiguration = $fieldConfiguration; |
|
| 152 | + return $this; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * @return array |
|
| 157 | + */ |
|
| 158 | + public function getGridRendererConfiguration() |
|
| 159 | + { |
|
| 160 | + return $this->gridRendererConfiguration; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * @param array $gridRendererConfiguration |
|
| 165 | + * @return $this |
|
| 166 | + */ |
|
| 167 | + public function setGridRendererConfiguration($gridRendererConfiguration) |
|
| 168 | + { |
|
| 169 | + $this->gridRendererConfiguration = $gridRendererConfiguration; |
|
| 170 | + return $this; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Get the Vidi Module Loader. |
|
| 175 | + * |
|
| 176 | + * @return ModuleLoader |
|
| 177 | + */ |
|
| 178 | + protected function getModuleLoader() |
|
| 179 | + { |
|
| 180 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * @return IconFactory |
|
| 185 | + */ |
|
| 186 | + protected function getIconFactory() |
|
| 187 | + { |
|
| 188 | + return GeneralUtility::makeInstance(IconFactory::class); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * @return LanguageService |
|
| 193 | + */ |
|
| 194 | + protected function getLanguageService() |
|
| 195 | + { |
|
| 196 | + return GeneralUtility::makeInstance(LanguageService::class); |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | 199 | } |
@@ -23,56 +23,56 @@ |
||
| 23 | 23 | class RelationEditRenderer extends ColumnRendererAbstract |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @return string |
|
| 28 | - */ |
|
| 29 | - public function render() |
|
| 30 | - { |
|
| 31 | - $output = ''; |
|
| 32 | - if ($this->isBackendMode()) { |
|
| 33 | - $output = $this->renderForBackend(); |
|
| 34 | - } |
|
| 26 | + /** |
|
| 27 | + * @return string |
|
| 28 | + */ |
|
| 29 | + public function render() |
|
| 30 | + { |
|
| 31 | + $output = ''; |
|
| 32 | + if ($this->isBackendMode()) { |
|
| 33 | + $output = $this->renderForBackend(); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - return $output; |
|
| 37 | - } |
|
| 36 | + return $output; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - protected function renderForBackend() |
|
| 43 | - { |
|
| 39 | + /** |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + protected function renderForBackend() |
|
| 43 | + { |
|
| 44 | 44 | |
| 45 | - // Initialize url parameters array. |
|
| 46 | - $urlParameters = array( |
|
| 47 | - $this->getModuleLoader()->getParameterPrefix() => array( |
|
| 48 | - 'controller' => 'Content', |
|
| 49 | - 'action' => 'edit', |
|
| 50 | - 'matches' => array('uid' => $this->object->getUid()), |
|
| 51 | - 'fieldNameAndPath' => $this->getFieldName(), |
|
| 52 | - ), |
|
| 53 | - ); |
|
| 45 | + // Initialize url parameters array. |
|
| 46 | + $urlParameters = array( |
|
| 47 | + $this->getModuleLoader()->getParameterPrefix() => array( |
|
| 48 | + 'controller' => 'Content', |
|
| 49 | + 'action' => 'edit', |
|
| 50 | + 'matches' => array('uid' => $this->object->getUid()), |
|
| 51 | + 'fieldNameAndPath' => $this->getFieldName(), |
|
| 52 | + ), |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - $fieldLabel = Tca::table()->field($this->getFieldName())->getLabel(); |
|
| 56 | - if ($fieldLabel) { |
|
| 57 | - $fieldLabel = str_replace(':', '', $fieldLabel); // sanitize label |
|
| 58 | - } |
|
| 55 | + $fieldLabel = Tca::table()->field($this->getFieldName())->getLabel(); |
|
| 56 | + if ($fieldLabel) { |
|
| 57 | + $fieldLabel = str_replace(':', '', $fieldLabel); // sanitize label |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - return sprintf( |
|
| 61 | - '<div style="text-align: right" class="pull-right invisible"><a href="%s" class="btn-edit-relation" data-field-label="%s">%s</a></div>', |
|
| 62 | - $this->getModuleLoader()->getModuleUrl($urlParameters), |
|
| 63 | - $fieldLabel, |
|
| 64 | - $this->getIconFactory()->getIcon('actions-edit-add', Icon::SIZE_SMALL) |
|
| 65 | - ); |
|
| 66 | - } |
|
| 60 | + return sprintf( |
|
| 61 | + '<div style="text-align: right" class="pull-right invisible"><a href="%s" class="btn-edit-relation" data-field-label="%s">%s</a></div>', |
|
| 62 | + $this->getModuleLoader()->getModuleUrl($urlParameters), |
|
| 63 | + $fieldLabel, |
|
| 64 | + $this->getIconFactory()->getIcon('actions-edit-add', Icon::SIZE_SMALL) |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Returns whether the current mode is Frontend |
|
| 70 | - * |
|
| 71 | - * @return bool |
|
| 72 | - */ |
|
| 73 | - protected function isBackendMode() |
|
| 74 | - { |
|
| 75 | - return TYPO3_MODE === 'BE'; |
|
| 76 | - } |
|
| 68 | + /** |
|
| 69 | + * Returns whether the current mode is Frontend |
|
| 70 | + * |
|
| 71 | + * @return bool |
|
| 72 | + */ |
|
| 73 | + protected function isBackendMode() |
|
| 74 | + { |
|
| 75 | + return TYPO3_MODE === 'BE'; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | } |