示例#1
0
 /**
  * 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;
 }
示例#2
0
 public function restoreValue(Method $method, $sanitize = true)
 {
     $this->isClicked = $method->hasValue($this->getName());
 }