Nextras\Forms\Controls\Fragments\ComponentControlTrait::loadState PHP Метод

loadState() публичный Метод

Loads state informations.
public loadState ( array $params ) : void
$params array
Результат void
    public function loadState(array $params)
    {
        $reflection = $this->getReflection();
        foreach ($reflection->getPersistentParams() as $name => $meta) {
            if (isset($params[$name])) {
                // NULLs are ignored
                $type = gettype($meta['def']);
                if (!$reflection->convertType($params[$name], $type)) {
                    throw new Nette\Application\BadRequestException(sprintf("Value passed to persistent parameter '%s' in %s must be %s, %s given.", $name, $this instanceof Presenter ? 'presenter ' . $this->getName() : "component '{$this->getUniqueId()}'", $type === 'NULL' ? 'scalar' : $type, is_object($params[$name]) ? get_class($params[$name]) : gettype($params[$name])));
                }
                $this->{$name} = $params[$name];
            } else {
                $params[$name] = $this->{$name};
            }
        }
        $this->params = $params;
    }