Skip to content

disabled in ActiveField will always be overwritten, when diasabled is set in ActiveForm #139

@HagnMarkus

Description

@HagnMarkus

Version 1.6.3

When disabled is set (true or false) in ActiveForm it overwrites always disabled in ActiveField. So it is not possible to set a Field to disabled in an enabled Form.

Code in ActiveField:

/**
 * Parses the form flag (for disabled/readonly).
 *
 * @param  string  $flag
 * @param  array  $options
 * @return void
 */
protected function parseFormFlag($flag, &$options)
{
    if (!property_exists($this->form, $flag)) {
        return;
    }
    $action = $this->form->$flag;
    if ($action && is_callable($action)) {
        $options[$flag] = call_user_func_array($action, [$this->model, $this]);
    } else {
        $options[$flag] = $action;
    }
}

Code in 1.6.2

if ($this->form->disabled && !isset($options['disabled'])) {
    $options['disabled'] = true;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions