[BUGFIX] Scheduler to show checkbox if "bool" typehint used in Controller 07/48507/2
authorRoland Waldner <mostwantedtypo3@gmail.com>
Tue, 7 Jun 2016 15:18:02 +0000 (17:18 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 8 Jun 2016 13:26:34 +0000 (15:26 +0200)
Until now if you wanted to use a checkbox you had to use "boolean" in that
typehint. If you used "bool" EXT:scheduler output a common input field. As
it seems to be encouraged by the TYPO3 core team to use "bool" PHPDoc
blocks, this commit makes sure that EXT:scheduler will also output a
checkobx if you use "bool" typehints.

Resolves: #76500
Releases: master, 7.6
Change-Id: Ie371e88e3a8e0a23d0cae2f893c5e7f14323068c
Reviewed-on: https://review.typo3.org/48507
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/extbase/Classes/Scheduler/FieldProvider.php

index e795014..bd8f338 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Extbase\Scheduler;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\Utility\TypeHandlingUtility;
+
 /**
  * Field provider for Extbase CommandController Scheduler task
  */
@@ -264,7 +266,7 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
         $command = $this->commandManager->getCommandByIdentifier($this->task->getCommandIdentifier());
         $argumentReflection = $this->reflectionService->getMethodParameters($command->getControllerClassName(), $command->getControllerCommandName() . 'Command');
         $defaultValue = $argumentReflection[$argumentName]['defaultValue'];
-        if ($type === 'boolean') {
+        if (TypeHandlingUtility::normalizeType($type) === 'boolean') {
             $defaultValue = (bool)$defaultValue ? 1 : 0;
         }
         return $defaultValue;
@@ -318,7 +320,7 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
         $type = $this->getArgumentType($argument);
         $name = $argument->getName();
         $fieldName = 'tx_scheduler[task_extbase][arguments][' . htmlspecialchars($name) . ']';
-        if ($type === 'boolean') {
+        if (TypeHandlingUtility::normalizeType($type) === 'boolean') {
             // checkbox field for boolean values.
             $html = '<input type="hidden" name="' . $fieldName . '" value="0">';
             $html .= '<div class="checkbox"><label><input type="checkbox" name="' . $fieldName . '" value="1" ' . ((bool)$currentValue ? ' checked="checked"' : '') . '></label></div>';