/**
  * @see OptionType::validate()
  */
 public function validate($optionData, $newValue)
 {
     $options = OptionUtil::parseSelectOptions($optionData['selectOptions']);
     if (!isset($options[$newValue])) {
         throw new UserInputException($optionData['optionName'], 'validationFailed');
     }
 }
 /**
  * @see OptionType::validate()
  */
 public function validate($optionData, $newValue)
 {
     if (!is_array($newValue)) {
         $newValue = array();
     }
     $options = OptionUtil::parseSelectOptions($optionData['selectOptions']);
     foreach ($newValue as $value) {
         if (!isset($options[$value])) {
             throw new UserInputException($optionData['optionName'], 'validationFailed');
         }
     }
 }
 /**
  * @see OptionType::getFormElement()
  */
 public function getFormElement(&$optionData)
 {
     if (!isset($optionData['optionValue'])) {
         if (isset($optionData['defaultValue'])) {
             $optionData['optionValue'] = $optionData['defaultValue'];
         } else {
             $optionData['optionValue'] = false;
         }
     }
     // get options
     $options = OptionUtil::parseSelectOptions($optionData['selectOptions']);
     WCF::getTPL()->assign(array('optionData' => $optionData, 'options' => $options));
     return WCF::getTPL()->fetch('optionTypeSelect');
 }
 protected static function getResult($optionData, $value)
 {
     $options = OptionUtil::parseSelectOptions($optionData['selectOptions']);
     // multiselect
     if (StringUtil::indexOf($value, "\n") !== false) {
         $values = explode("\n", $value);
         $result = array();
         foreach ($values as $value) {
             if (isset($options[$value])) {
                 $result[] = $options[$value];
             }
         }
         return $result;
     } else {
         if (!empty($value) && isset($options[$value])) {
             return $options[$value];
         }
         return null;
     }
 }
 /**
  * @see TemplatePluginModifier::execute()
  */
 public function execute($tagArgs, Template $tplObj)
 {
     return OptionUtil::parseSelectOptions($tagArgs[0]);
 }