示例#1
0
 /**
  * Create an options array (Needed for fieldsettings: select, radio, check)
  *        option1 =>
  *            label => Red Shoes
  *            value => red
  *            selected => 1
  *
  * @param string $string Options from the Textarea
  * @param string $typoScriptObjectPath Path to TypoScript like lib.blabla
  * @param bool $parse
  * @return array Options Array
  */
 protected function optionArray($string, $typoScriptObjectPath, $parse = true)
 {
     if (empty($string)) {
         $string = TypoScriptUtility::parseTypoScriptFromTypoScriptPath($typoScriptObjectPath);
     }
     if (empty($string)) {
         $string = 'Error, no options to show';
     }
     return $this->buildOptions($string, $parse);
 }
示例#2
0
 /**
  * Create an options array (Needed for fieldsettings: select, radio, check)
  *        option1 =>
  *            label => Red Shoes
  *            value => red
  *            selected => 1
  *
  * @param string $string Options from the Textarea
  * @param string $typoScriptObjectPath Path to TypoScript like lib.blabla
  * @param bool $parse
  * @return array Options Array
  */
 protected function optionArray($string, $typoScriptObjectPath, $parse = true)
 {
     if (empty($string)) {
         $string = TypoScriptUtility::parseTypoScriptFromTypoScriptPath($typoScriptObjectPath);
     }
     if (empty($string)) {
         $string = 'Error, no options to show';
     }
     $options = array();
     $string = str_replace('[\\n]', PHP_EOL, $string);
     $settingsField = GeneralUtility::trimExplode(PHP_EOL, $string, true);
     foreach ($settingsField as $line) {
         $settings = GeneralUtility::trimExplode('|', $line, false);
         $value = isset($settings[1]) ? $settings[1] : $settings[0];
         $label = $parse ? TemplateUtility::fluidParseString($settings[0]) : $settings[0];
         $options[] = array('label' => $label, 'value' => $value, 'selected' => isset($settings[2]) ? 1 : 0);
     }
     return $options;
 }