Esempio n. 1
0
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->overrideArgument('options', 'array', 'Override; optional in this ViewHelper', FALSE, array());
     $this->registerArgument('csv', 'string', 'Optional CSV alternative options list', FALSE);
     $this->registerArgument('table', 'string', 'Optional table name from which to load options', FALSE);
 }
 /**
  * @test
  */
 public function multipleSelectOnDomainObjectsCreatesExpectedOptionsWithoutOptionValueField()
 {
     /** @var $mockPersistenceManager \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface */
     $mockPersistenceManager = $this->getMock(\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface::class);
     $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnCallback(function ($object) {
         return $object->getId();
     }));
     $this->viewHelper->_set('persistenceManager', $mockPersistenceManager);
     $this->tagBuilder = new \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder();
     $this->viewHelper->expects($this->exactly(3))->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
     $user_is = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(1, 'Ingmar', 'Schlecht');
     $user_sk = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(2, 'Sebastian', 'Kurfuerst');
     $user_rl = new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass(3, 'Robert', 'Lemke');
     $this->arguments['options'] = array($user_is, $user_sk, $user_rl);
     $this->arguments['value'] = array($user_rl, $user_is);
     $this->arguments['optionLabelField'] = 'lastName';
     $this->arguments['name'] = 'myName';
     $this->arguments['multiple'] = true;
     $this->injectDependenciesIntoViewHelper($this->viewHelper);
     $this->viewHelper->initializeArguments();
     $this->viewHelper->initialize();
     $actual = $this->viewHelper->render();
     $expected = '<input type="hidden" name="myName" value="" />' . '<select multiple="multiple" name="myName[]">' . '<option value="1" selected="selected">Schlecht</option>' . chr(10) . '<option value="2">Kurfuerst</option>' . chr(10) . '<option value="3" selected="selected">Lemke</option>' . chr(10) . '</select>';
     $this->assertSame($expected, $actual);
 }
 /**
  * Initialize arguments. Cant be moved to parent because of
  * "private $argumentDefinitions = array();"
  *
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->overrideArgument('options', 'object', 'Associative array with internal IDs as key, and the values are displayed in the select box', false);
     $this->overrideArgument('optionValueField', 'string', 'If specified, will call the appropriate getter on each object to determine the value.', false, 'isoCodeA2');
     $this->overrideArgument('optionLabelField', 'string', 'If specified, will call the appropriate getter on each object to determine the label.', false, 'shortNameLocal');
     $this->overrideArgument('sortByOptionLabel', 'boolean', 'If true, List will be sorted by label.', false, true);
     $this->registerArgument('allowedCountries', 'array', 'Array with countries allowed to be displayed.', false, array());
 }
 /**
  * Initialize
  *
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('defaultOption', 'string', 'value to prepend', false);
 }
 /**
  * Initialize arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('optionLabelPrefix', 'string', 'Prefix for locallang lookup');
 }
Esempio n. 6
0
 /**
  * Initialize arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerTagAttribute('categoryPid', 'integer', 'The Pid, where the categories should be taken from', true);
     $this->overrideArgument('options', 'array', 'Associative array with internal IDs as key, and the values are displayed in the select box', false);
 }
 /**
  *
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('nullOption', 'string', 'If specified, an extra option is added on top of the others labeled with the given string and valued as null');
     $this->registerArgument('dataPlaceholder', 'string', 'If specified, value will populate the select tag\'s data-placeholder attribute');
 }
 /**
  * Initialize arguments.
  *
  * @return void
  * @author Sebastian Kurfürst <*****@*****.**>
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('emptyOption', 'string', 'Additional option with empty value', false, false);
 }
 /**
  * Initialize arguments.
  *
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('staticInfoTable', 'string', 'set the tablename of the StaticInfoTable to build the Select-Tag.');
     $this->registerArgument('staticInfoTableSubselect', 'array', '{fieldname: fieldvalue}');
     $this->registerArgument('defaultOptionLabel', 'string', 'if set, add default option with given label');
     $this->registerArgument('defaultOptionValue', 'string', 'if set, add default option with given label');
 }
 /**
  * Initialize arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('optionDataAttributes', 'array', 'Additional data-attributes for options: data-{key}="property:{value}"', false);
 }
Esempio n. 11
0
 /**
  * Initialize arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerTagAttribute('onchange', 'string', 'Event when selection is changed');
 }
 /**
  * Arguments initialization
  *
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('optionIcon', 'string', 'If specified, will show the given icon in front of each option label.');
 }
Esempio n. 13
0
 /**
  * Initialize arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('nameAsArray', 'boolean', 'Makes the name attribute as array', FALSE, FALSE);
     $this->registerArgument('renderSubGroups', 'boolean', 'Render child groups as options', FALSE, FALSE);
 }