/**
  * Render a Flexible Content Element type selection field
  *
  * @param array $parameters
  * @param mixed $parentObject
  * @return string
  */
 public function renderField(array &$parameters, &$parentObject)
 {
     /** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */
     $cacheManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('TYPO3\\CMS\\Core\\Cache\\CacheManager');
     /** @var StringFrontend $cache */
     $cache = $cacheManager->getCache('fluidcontent');
     $pageTypoScript = TRUE === $cache->has('pageTsConfig') ? $cache->get('pageTsConfig') : array();
     $tsParser = new TypoScriptParser();
     $conditions = new ConditionMatcher();
     $pageUid = GeneralUtility::_GET('id');
     $pageUid = intval($pageUid);
     if (0 === $pageUid) {
         $pageUid = intval($parameters['row']['pid']);
     }
     $conditions->setPageId($pageUid);
     $tsParser->parse($pageTypoScript, $conditions);
     $setup = $tsParser->setup['mod.']['wizards.']['newContentElement.']['wizardItems.'];
     if (FALSE === is_array($setup)) {
         return LocalizationUtility::translate('pages.no_content_types', 'Fluidcontent');
     }
     $setup = GeneralUtility::removeDotsFromTS($setup);
     $name = $parameters['itemFormElName'];
     $value = $parameters['itemFormElValue'];
     $select = '<div><select name="' . htmlspecialchars($name) . '"  class="formField select" onchange="if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };">' . LF;
     $select .= '<option value="">' . $GLOBALS['LANG']->sL('LLL:EXT:fluidcontent/Resources/Private/Language/locallang.xml:tt_content.tx_fed_fcefile', TRUE) . '</option>' . LF;
     foreach ($setup as $groupLabel => $configuration) {
         $select .= '<optgroup label="' . htmlspecialchars($groupLabel) . '">' . LF;
         foreach ($configuration['elements'] as $elementConfiguration) {
             $optionValue = $elementConfiguration['tt_content_defValues']['tx_fed_fcefile'];
             $selected = $optionValue === $value ? ' selected="selected"' : '';
             $label = $elementConfiguration['title'];
             $label = $GLOBALS['LANG']->sL($label);
             $select .= '<option value="' . htmlspecialchars($optionValue) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>' . LF;
         }
         $select .= '</optgroup>' . LF;
     }
     $select .= '</select></div>' . LF;
     unset($parentObject);
     return $select;
 }
 /**
  * @test
  * @return void
  */
 public function testUserFuncWithClassMethodCall()
 {
     $this->assertTrue($this->conditionMatcher->match('[userFunc = ConditionMatcherUserFunctions::isTrue(1)]'));
 }
 /**
  * @test
  * @expectedException \TYPO3\CMS\Backend\Tests\Unit\Configuration\TypoScript\ConditionMatching\Fixtures\TestConditionException
  */
 public function matchCallsTestConditionAndHandsOverParameters()
 {
     $this->matchCondition->match('[TYPO3\\CMS\\Backend\\Tests\\Unit\\Configuration\\TypoScript\\ConditionMatching\\Fixtures\\TestCondition = 7, != 6]');
 }
 /**
  * Tests whether determining a pageId works.
  *
  * @test
  */
 public function pageIdCanBeDeterminedWhileMovingARecordToAnotherPage()
 {
     $_GET['cmd']['pages'][121]['move'] = 999;
     $this->matchCondition->match('[globalVar = LIT:10 = 10]');
     $this->assertEquals(999, $this->matchCondition->getPageId());
 }
 /**
  * @test
  * @return void
  */
 public function testUserFuncWithQuotesInside()
 {
     $this->assertTrue($this->conditionMatcher->match('[userFunc = user_testQuotes("1 \\" 2") ]'));
 }