/** * Restores the value from the provided method * @param Method $method * @param bool $sanitize Whether to sanitize the fetched value */ public function restoreValue(Method $method, $sanitize = true) { $v = $method->getValue($this->getName(), $this->getRestoreDefault()); if ($this->isMultiple() && is_array($v)) { foreach ($v as &$value) { $value = $this->importValue($value); } } else { $v = $this->importValue($v); } if ($sanitize) { foreach ($this->sanitizers as $s) { /* @var $s FieldSanitizer */ $v = $s->sanitize($v); } } $this->value = $v; $this->restored = true; }
public function restoreValue(Method $method, $sanitize = true) { $this->isClicked = $method->hasValue($this->getName()); }