/** * 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; }
/** * Sets the $value to a cleaned value of $originalValue. * * TODO: the per-parameter lowercaseing and trimming here needs some thought * * @since 1.0 * * @param Options $options */ protected function cleanValue(Options $options) { $this->value = $this->originalValue; $trim = $this->getDefinition()->trimDuringClean(); if ($trim === true || is_null($trim) && $options->trimValues()) { if (is_string($this->value)) { $this->value = trim($this->value); } } if ($this->definition->isList()) { $this->value = explode($this->definition->getDelimiter(), $this->value); if ($trim === true || is_null($trim) && $options->trimValues()) { foreach ($this->value as &$element) { if (is_string($element)) { $element = trim($element); } } } } $definitionOptions = $this->definition->getOptions(); if ($options->lowercaseValues() || array_key_exists('tolower', $definitionOptions) && $definitionOptions['tolower']) { if ($this->definition->isList()) { foreach ($this->value as &$element) { if (is_string($element)) { $element = strtolower($element); } } } elseif (is_string($this->value)) { $this->value = strtolower($this->value); } } }