Collective\Html\FormBuilder::getCheckboxCheckedState PHP Метод

getCheckboxCheckedState() защищенный Метод

Get the check state for a checkbox input.
protected getCheckboxCheckedState ( string $name, mixed $value, boolean $checked ) : boolean
$name string
$value mixed
$checked boolean
Результат boolean
    protected function getCheckboxCheckedState($name, $value, $checked)
    {
        if (isset($this->session) && !$this->oldInputIsEmpty() && is_null($this->old($name))) {
            return false;
        }
        if ($this->missingOldAndModel($name)) {
            return $checked;
        }
        $posted = $this->getValueAttribute($name, $checked);
        if (is_array($posted)) {
            return in_array($value, $posted);
        } elseif ($posted instanceof Collection) {
            return $posted->contains('id', $value);
        } else {
            return (bool) $posted;
        }
    }