[BUGFIX] Fix typo in UserElement.php
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Form / Element / UserElement.php
index b2c293e..7b0e439 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace TYPO3\CMS\Backend\Form\Element;
 
-/**
+/*
  * This file is part of the TYPO3 CMS project.
  *
  * It is free software; you can redistribute it and/or modify it under
@@ -14,40 +14,40 @@ namespace TYPO3\CMS\Backend\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
- * Generation of TCEform elements of the type "user"
+ * Generation of elements of the type "user"
  */
-class UserElement {
-
-       /**
-        * @var \TYPO3\CMS\Backend\Form\FormEngine
-        */
-       protected $formEngine;
-
-       /**
-        * Constructor function, setting the FormEngine
-        *
-        * @param \TYPO3\CMS\Backend\Form\FormEngine $formEngine
-        */
-       public function __construct(\TYPO3\CMS\Backend\Form\FormEngine $formEngine) {
-               $this->formEngine = $formEngine;
-       }
+class UserElement extends AbstractFormElement
+{
+    /**
+     * User defined field type
+     *
+     * @return array As defined in initializeResultArray() of AbstractNode
+     */
+    public function render()
+    {
+        $resultArray = $this->initializeResultArray();
 
-       /**
-        * User defined field type
-        *
-        * @param string $table The table name of the record
-        * @param string $field The field name which this element is supposed to edit
-        * @param array $row The record data array where the value(s) for the field can be found
-        * @param array $additionalInformation An array with additional configuration options.
-        * @return string The HTML code for the TCEform field
-        */
-       public function render($table, $field, $row, &$additionalInformation) {
-               $additionalInformation['table'] = $table;
-               $additionalInformation['field'] = $field;
-               $additionalInformation['row'] = $row;
-               $additionalInformation['parameters'] = isset($additionalInformation['fieldConf']['config']['parameters']) ? $additionalInformation['fieldConf']['config']['parameters'] : array();
-               $additionalInformation['pObj'] = &$this;
-               return \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($additionalInformation['fieldConf']['config']['userFunc'], $additionalInformation, $this);
-       }
-}
\ No newline at end of file
+        $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;
+    }
+}