[FOLLOWUP][TASK] FormEngine: The factory 98/39598/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 18 May 2015 12:43:41 +0000 (14:43 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Mon, 18 May 2015 13:00:23 +0000 (15:00 +0200)
Small follow up to fix some mostly cosmetical issues.

Resolves: #67006
Releases: master
Change-Id: Ie9ffab0e5bce9e8c97d87a6ff4c213e788cd1bf7
Reviewed-on: http://review.typo3.org/39598
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php
typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php
typo3/sysext/backend/Classes/Form/FormDataTraverser.php
typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php

index 03bf7b1..898cc2e 100644 (file)
@@ -105,7 +105,7 @@ class SelectCheckBoxElement extends AbstractFormElement {
                                // Non-selectable element:
                                if ($p[1] === '--div--') {
                                        $selIcon = '';
-                                       if (isset($p[2]) && $p[2] != 'empty-emtpy') {
+                                       if (isset($p[2]) && $p[2] != 'empty-empty') {
                                                $selIcon = FormEngineUtility::getIconHtml($p[2]);
                                        }
                                        $currentGroup++;
@@ -182,10 +182,10 @@ class SelectCheckBoxElement extends AbstractFormElement {
                $output .= '<input type="hidden" class="select-checkbox" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '" value="" />';
 
                // Building the checkboxes
-               foreach($groups as $groupKey => $group){
+               foreach ($groups as $groupKey => $group) {
                        $groupId = htmlspecialchars($parameterArray['itemFormElID']) . '-group-' . $groupKey;
                        $output .= '<div class="panel panel-default">';
-                       if(is_array($group['header'])){
+                       if (is_array($group['header'])) {
                                $output .= '
                                        <div class="panel-heading">
                                                <a data-toggle="collapse" href="#' . $groupId . '" aria-expanded="true" aria-controls="' . $groupId . '">
@@ -195,14 +195,14 @@ class SelectCheckBoxElement extends AbstractFormElement {
                                        </div>
                                        ';
                        }
-                       if(is_array($group['items']) && count($group['items']) >= 1){
+                       if (is_array($group['items']) && !empty($group['items'])) {
                                $tableRows = '';
                                $checkGroup = array();
                                $uncheckGroup = array();
                                $resetGroup = array();
 
                                // Render rows
-                               foreach($group['items'] as $item){
+                               foreach ($group['items'] as $item) {
                                        $tableRows .= '
                                                <tr class="' . $item['class'] . '">
                                                        <td class="col-checkbox">
@@ -231,7 +231,7 @@ class SelectCheckBoxElement extends AbstractFormElement {
 
                                // Build toggle group checkbox
                                $toggleGroupCheckbox = '';
-                               if(count($resetGroup)){
+                               if (!empty($resetGroup)) {
                                        $toggleGroupCheckbox = '
                                                <input type="checkbox" class="checkbox" onclick="if (checked) {' . htmlspecialchars(implode('', $checkGroup) . '} else {' . implode('', $uncheckGroup)) . '}">
                                                ';
@@ -239,7 +239,7 @@ class SelectCheckBoxElement extends AbstractFormElement {
 
                                // Build reset group button
                                $resetGroupBtn = '';
-                               if(count($resetGroup)){
+                               if (!empty($resetGroup)) {
                                        $resetGroupBtn = '
                                                <a href="#" class="btn btn-default" onclick="' . implode('', $resetGroup) . ' return false;' . '">
                                                        ' . IconUtility::getSpriteIcon('actions-edit-undo', array('title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.revertSelection')))) . '
index a5ad9b3..490b535 100644 (file)
@@ -96,9 +96,10 @@ class SelectSingleElement extends AbstractFormElement {
                        $inlineFormName = $inlineStackProcessor->getCurrentStructureFormPrefix();
                        if ($inlineParent['config']['foreign_table'] == $table && $inlineParent['config']['foreign_unique'] == $field) {
                                $uniqueIds = $this->globalOptions['inlineData']['unique'][$inlineObjectName . '-' . $table]['used'];
-                               $parameterArray['fieldChangeFunc']['inlineUnique'] = 'inline.updateUnique(this,\'' . $inlineObjectName
-                                       . '-' . $table . '\',\'' . $inlineFormName
-                                       . '\',\'' . $row['uid'] . '\');';
+                               $parameterArray['fieldChangeFunc']['inlineUnique'] = 'inline.updateUnique(this,'
+                                       . GeneralUtility::quoteJSvalue($inlineObjectName . '-' . $table) . ','
+                                       . GeneralUtility::quoteJSvalue($inlineFormName) . ','
+                                       . GeneralUtility::quoteJSvalue($row['uid']) . ');';
                        }
                        // hide uid of parent record for symmetric relations
                        if (
@@ -139,9 +140,9 @@ class SelectSingleElement extends AbstractFormElement {
                }
 
                // Icon configuration:
-               if ($config['suppress_icons'] == 'IF_VALUE_FALSE') {
+               if ($config['suppress_icons'] === 'IF_VALUE_FALSE') {
                        $suppressIcons = !$parameterArray['itemFormElValue'] ? 1 : 0;
-               } elseif ($config['suppress_icons'] == 'ONLY_SELECTED') {
+               } elseif ($config['suppress_icons'] === 'ONLY_SELECTED') {
                        $suppressIcons = 0;
                        $onlySelectedIconShown = 1;
                } elseif ($config['suppress_icons']) {
index d3e9323..f58dfda 100644 (file)
@@ -343,7 +343,7 @@ class FormDataTraverser {
                $PA['fieldConf']['config'] = FormEngineUtility::overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']);
                $selectItemArray = FormEngineUtility::getSelectItems($this->currentTable, $fieldName, $this->currentRow, $PA);
 
-               if ($isTraversable && count($selectItemArray)) {
+               if ($isTraversable && !empty($selectItemArray)) {
                        $this->currentTable = $fieldConfig['foreign_table'];
                        $relatedUids = $this->getSelectedValuesFromSelectItemArray($selectItemArray, $value);
                } else {
index 5834578..d854dea 100644 (file)
@@ -473,8 +473,7 @@ class FormEngineUtility {
                                        $theTypes = $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'];
                                        foreach ($theTypes as $theTypeArrays) {
                                                // Icon:
-                                               // @todo: typo here
-                                               $icon = 'empty-emtpy';
+                                               $icon = 'empty-empty';
                                                if ($theTypeArrays[1] != '--div--') {
                                                        $icon = IconUtility::mapRecordTypeToSpriteIconName('pages', array('doktype' => $theTypeArrays[1]));
                                                }