[BUGFIX] Fix several typos in php comments
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Form / Element / InputDateTimeElement.php
index 3b300e8..1c4092e 100644 (file)
@@ -26,6 +26,17 @@ use TYPO3\CMS\Core\Utility\StringUtility;
 class InputDateTimeElement extends AbstractFormElement
 {
     /**
+     * Default field information enabled for this element.
+     *
+     * @var array
+     */
+    protected $defaultFieldInformation = [
+        'tcaDescription' => [
+            'renderType' => 'tcaDescription',
+        ],
+    ];
+
+    /**
      * Default field wizards enabled for this element.
      *
      * @var array
@@ -91,11 +102,16 @@ class InputDateTimeElement extends AbstractFormElement
         $size = MathUtility::forceIntegerInRange($config['size'] ?? $defaultInputWidth, $this->minimumInputWidth, $this->maxInputWidth);
         $width = (int)$this->formMaxWidth($size);
 
+        $fieldInformationResult = $this->renderFieldInformation();
+        $fieldInformationHtml = $fieldInformationResult['html'];
+        $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
+
         if (isset($config['readOnly']) && $config['readOnly']) {
             // Early return for read only fields
             $itemValue = $this->formatValue($format, $itemValue);
             $html = [];
             $html[] = '<div class="formengine-field-item t3js-formengine-field-item">';
+            $html[] =   $fieldInformationHtml;
             $html[] =   '<div class="form-wizards-wrap">';
             $html[] =       '<div class="form-wizards-element">';
             $html[] =           '<div class="form-control-wrap" style="max-width: ' . $width . 'px">';
@@ -144,7 +160,7 @@ class InputDateTimeElement extends AbstractFormElement
                 // (moment.js can only handle UTC or browser's local timezone), we need to offset the value
                 // to eliminate the timezone. JS will receive all dates as if they were UTC, which we undo on save in DataHandler
                 $adjustedValue = $itemValue + date('Z', (int)$itemValue);
-                // output date as a ISO-8601 date
+                // output date as an ISO-8601 date
                 $itemValue = gmdate('c', $adjustedValue);
             }
             if (isset($config['range']['lower'])) {
@@ -160,10 +176,6 @@ class InputDateTimeElement extends AbstractFormElement
             $itemValue = gmdate('c', (int)$itemValue);
         }
 
-        $fieldInformationResult = $this->renderFieldInformation();
-        $fieldInformationHtml = $fieldInformationResult['html'];
-        $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
-
         $fieldWizardResult = $this->renderFieldWizard();
         $fieldWizardHtml = $fieldWizardResult['html'];
         $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldWizardResult, false);
@@ -186,14 +198,18 @@ class InputDateTimeElement extends AbstractFormElement
         $expansionHtml[] =              '</span>';
         $expansionHtml[] =          '</div>';
         $expansionHtml[] =      '</div>';
-        $expansionHtml[] =      '<div class="form-wizards-items-aside">';
-        $expansionHtml[] =          '<div class="btn-group">';
-        $expansionHtml[] =              $fieldControlHtml;
-        $expansionHtml[] =          '</div>';
-        $expansionHtml[] =      '</div>';
-        $expansionHtml[] =      '<div class="form-wizards-items-bottom">';
-        $expansionHtml[] =          $fieldWizardHtml;
-        $expansionHtml[] =      '</div>';
+        if (!empty($fieldControlHtml)) {
+            $expansionHtml[] =      '<div class="form-wizards-items-aside">';
+            $expansionHtml[] =          '<div class="btn-group">';
+            $expansionHtml[] =              $fieldControlHtml;
+            $expansionHtml[] =          '</div>';
+            $expansionHtml[] =      '</div>';
+        }
+        if (!empty($fieldWizardHtml)) {
+            $expansionHtml[] = '<div class="form-wizards-items-bottom">';
+            $expansionHtml[] = $fieldWizardHtml;
+            $expansionHtml[] = '</div>';
+        }
         $expansionHtml[] =  '</div>';
         $expansionHtml[] = '</div>';
         $expansionHtml = implode(LF, $expansionHtml);
@@ -231,9 +247,6 @@ class InputDateTimeElement extends AbstractFormElement
                     );
                 }
             } else {
-                $fallbackValue = 1;
-                $checked = ' checked="checked"';
-                $disabled = ' disabled="disabled"';
                 $overrideLabel = $languageService->sL(
                     'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override_not_available'
                 );
@@ -257,6 +270,7 @@ class InputDateTimeElement extends AbstractFormElement
             $fullElement = implode(LF, $fullElement);
         }
 
+        $resultArray['requireJsModules'][] = 'TYPO3/CMS/Backend/FormEngine/Element/InputDateTimeElement';
         $resultArray['html'] = '<div class="formengine-field-item t3js-formengine-field-item">' . $fieldInformationHtml . $fullElement . '</div>';
         return $resultArray;
     }