Example #1
0
 /**
  * Returns the value to initially display with the input.
  * 
  * @since 1.9
  * 
  * @return string
  */
 protected function getValueToUse()
 {
     $value = $this->currentValue === false ? $this->param->getDefault() : $this->currentValue;
     if ($this->param->isList() && is_array($value)) {
         $value = implode($this->param->getDelimiter(), $value);
     }
     return $value;
 }
Example #2
0
 /**
  * @since 1.0
  *
  * @param Options $options
  */
 protected function parseAndValidate(Options $options)
 {
     $parser = $this->getValueParser($options);
     if ($this->definition->isList()) {
         $values = array();
         foreach ($this->getValue() as $value) {
             $parsedValue = $this->parseAndValidateValue($parser, $value);
             if (is_array($parsedValue)) {
                 $values[] = $parsedValue[0];
             }
         }
         $this->setValue($values);
     } else {
         $parsedValue = $this->parseAndValidateValue($parser, $this->getValue());
         if (is_array($parsedValue)) {
             $this->setValue($parsedValue[0]);
         }
     }
     $this->setToDefaultIfNeeded();
 }