[BUGFIX] Fix typo in UserElement.php
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Form / Element / UserElement.php
index f6ce436..7b0e439 100644 (file)
@@ -15,35 +15,39 @@ namespace TYPO3\CMS\Backend\Form\Element;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Backend\Form\FormEngine;
 
 /**
- * Generation of TCEform elements of the type "user"
+ * Generation of elements of the type "user"
  */
-class UserElement extends AbstractFormElement {
-
-       /**
-        * User defined field type
-        *
-        * @return array As defined in initializeResultArray() of AbstractNode
-        */
-       public function render() {
-               $parameterArray = $this->data['parameterArray'];
-               $parameterArray['table'] = $this->data['tableName'];
-               $parameterArray['field'] = $this->data['fieldName'];
-               $parameterArray['row'] = $this->data['databaseRow'];
-               $parameterArray['parameters'] = isset($parameterArray['fieldConf']['config']['parameters'])
-                       ? $parameterArray['fieldConf']['config']['parameters']
-                       : array();
-               // Instance of FormEngine is kept here for backwards compatibility - but it is a dummy only
-               $parameterArray['pObj'] = $this;
-               $resultArray = $this->initializeResultArray();
-               $resultArray['html'] = GeneralUtility::callUserFunction(
-                       $parameterArray['fieldConf']['config']['userFunc'],
-                       $parameterArray,
-                       $dummyFormEngine
-               );
-               return $resultArray;
-       }
+class UserElement extends AbstractFormElement
+{
+    /**
+     * User defined field type
+     *
+     * @return array As defined in initializeResultArray() of AbstractNode
+     */
+    public function render()
+    {
+        $resultArray = $this->initializeResultArray();
 
+        $parameterArray = $this->data['parameterArray'];
+        $parameterArray['table'] = $this->data['tableName'];
+        $parameterArray['field'] = $this->data['fieldName'];
+        $parameterArray['row'] = $this->data['databaseRow'];
+        $parameterArray['parameters'] = isset($parameterArray['fieldConf']['config']['parameters'])
+            ? $parameterArray['fieldConf']['config']['parameters']
+            : [];
+        $html = GeneralUtility::callUserFunction(
+            $parameterArray['fieldConf']['config']['userFunc'],
+            $parameterArray,
+            $this
+        );
+        if (!isset($parameterArray['fieldConf']['config']['noTableWrapping'])
+            || (bool)$parameterArray['fieldConf']['config']['noTableWrapping'] === false
+        ) {
+            $html = '<div class="formengine-field-item t3js-formengine-field-item">' . $html . '</div>';
+        }
+        $resultArray['html'] = $html;
+        return $resultArray;
+    }
 }