/**
  * Override the initialize method to load all available country
  * zones for a given parent country before rendering
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     if ($this->hasArgument('parent') && $this->arguments['parent'] != '' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) {
         $this->arguments['options'] = $this->countryZonesRepository->findAllByIso2($this->arguments['parent']);
     }
 }
 /**
  * Override the initialize method to load all available
  * countries before rendering
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) {
         if ($this->hasArgument('allowedCountries') && count($this->arguments['allowedCountries'])) {
             $result = $this->countryRepository->findByIsoCodeA2($this->arguments['allowedCountries']);
         } else {
             $result = $this->countryRepository->findAll();
         }
         if (!empty($this->arguments['allowedCountries'])) {
             $orderedResults = array();
             foreach ($this->arguments['allowedCountries'] as $countryKey) {
                 foreach ($result as $country) {
                     if ($country->getIsoCodeA2() == $countryKey) {
                         $orderedResults[] = $country;
                     }
                 }
             }
             $result = $orderedResults;
         }
         $this->arguments['options'] = array();
         foreach ($result as $country) {
             $this->arguments['options'][] = $country;
         }
     }
 }
 /**
  * Initialize the viewHelper
  */
 public function initialize()
 {
     parent::initialize();
     $this->captionRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_PtExtlist_Domain_Renderer_Default_CaptionRenderer');
     // TODO Remove this, once we have DI
     $configurationBuilderFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('Tx_PtExtlist_Domain_Configuration_ConfigurationBuilderFactory');
     /* @var $configurationBuilderFactory Tx_PtExtlist_Domain_Configuration_ConfigurationBuilderFactory */
     $configurationBuilder = $configurationBuilderFactory->getInstance();
     $this->columnSelectorConfig = $configurationBuilder->buildColumnSelectorConfiguration();
 }
 /**
  * Override the initialize method to load all
  * available languages before rendering
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) {
         if ($this->hasArgument('allowedLanguages') && count($this->arguments['allowedLanguages'])) {
             $this->arguments['options'] = $this->languageRepository->findByLgCollateLocale($this->arguments['allowedLanguages']);
         } else {
             $this->arguments['options'] = $this->languageRepository->findAll();
         }
     }
 }
 /**
  * @test
  */
 public function optionsContainPrependedItemWithCorrectValueIfPrependOptionLabelAndPrependOptionValueAreSet()
 {
     $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
     $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
     $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="-1">please choose</option>' . chr(10) . '<option value="value1">label1</option>' . chr(10) . '<option value="value2">label2</option>' . chr(10) . '<option value="value3">label3</option>' . chr(10));
     $this->tagBuilder->expects($this->once())->method('render');
     $this->arguments['options'] = array('value1' => 'label1', 'value2' => 'label2', 'value3' => 'label3');
     $this->arguments['name'] = 'myName';
     $this->arguments['prependOptionLabel'] = 'please choose';
     $this->arguments['prependOptionValue'] = '-1';
     $this->injectDependenciesIntoViewHelper($this->viewHelper);
     $this->viewHelper->initialize();
     $this->viewHelper->render();
 }