[!!!][FEATURE] FormEngine element level refactoring
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Form / Element / RadioElement.php
index 96b6d08..3d75f71 100644 (file)
@@ -20,12 +20,31 @@ namespace TYPO3\CMS\Backend\Form\Element;
 class RadioElement extends AbstractFormElement
 {
     /**
+     * Default field wizards enabled for this element.
+     *
+     * @var array
+     */
+    protected $defaultFieldWizard = [
+        'otherLanguageContent' => [
+            'renderType' => 'otherLanguageContent',
+        ],
+        'defaultLanguageDifferences' => [
+            'renderType' => 'defaultLanguageDifferences',
+            'after' => [
+                'otherLanguageContent',
+            ],
+        ],
+    ];
+
+    /**
      * This will render a series of radio buttons.
      *
      * @return array As defined in initializeResultArray() of AbstractNode
      */
     public function render()
     {
+        $resultArray = $this->initializeResultArray();
+
         $disabled = '';
         if ($this->data['parameterArray']['fieldConf']['config']['readOnly']) {
             $disabled = ' disabled';
@@ -37,22 +56,44 @@ class RadioElement extends AbstractFormElement
             $value = $itemLabelAndValue[1];
             $radioId = htmlspecialchars($this->data['parameterArray']['itemFormElID'] . '_' . $itemNumber);
             $radioChecked = (string)$value === (string)$this->data['parameterArray']['itemFormElValue'] ? ' checked="checked"' : '';
-            $html[] = '<div class="radio' . $disabled . '">';
-            $html[] =    '<label for="' . $radioId . '">';
-            $html[] =        '<input type="radio"'
-                                . ' name="' . htmlspecialchars($this->data['parameterArray']['itemFormElName']) . '"'
-                                . ' id="' . $radioId . '"'
-                                . ' value="' . htmlspecialchars($value) . '"'
-                                . $radioChecked
-                                . $disabled
-                                . ' onclick="' . htmlspecialchars(implode('', $this->data['parameterArray']['fieldChangeFunc'])) . '"'
-                            . '/>'
-                            . htmlspecialchars($label);
-            $html[] =    '</label>';
+
+            $fieldInformationResult = $this->renderFieldInformation();
+            $fieldInformationHtml = $fieldInformationResult['html'];
+            $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
+
+            $fieldWizardResult = $this->renderFieldWizard();
+            $fieldWizardHtml = $fieldWizardResult['html'];
+            $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldWizardResult, false);
+
+            $html[] = '<div class="t3js-formengine-field-item">';
+            if (!$disabled) {
+                $html[] = $fieldInformationHtml;
+            }
+            $html[] =   '<div class="form-wizards-wrap">';
+            $html[] =       '<div class="form-wizards-element">';
+            $html[] =           '<div class="radio' . $disabled . '">';
+            $html[] =               '<label for="' . $radioId . '">';
+            $html[] =                   '<input type="radio"';
+            $html[] =                       ' name="' . htmlspecialchars($this->data['parameterArray']['itemFormElName']) . '"';
+            $html[] =                       ' id="' . $radioId . '"';
+            $html[] =                       ' value="' . htmlspecialchars($value) . '"';
+            $html[] =                       $radioChecked;
+            $html[] =                       $disabled;
+            $html[] =                       ' onclick="' . htmlspecialchars(implode('', $this->data['parameterArray']['fieldChangeFunc'])) . '"';
+            $html[] =                   '/>';
+            $html[] =                       htmlspecialchars($label);
+            $html[] =               '</label>';
+            $html[] =           '</div>';
+            $html[] =       '</div>';
+            if (!$disabled) {
+                $html[] =   '<div class="form-wizards-items-bottom">';
+                $html[] =       $fieldWizardHtml;
+                $html[] =   '</div>';
+            }
+            $html[] =   '</div>';
             $html[] = '</div>';
         }
 
-        $resultArray = $this->initializeResultArray();
         $resultArray['html'] = implode(LF, $html);
         return $resultArray;
     }