protected function filterAttributes($attributes, $position = 'field')
    {
        $position = strtolower($position);

        $attributes = $this->filterTriggerAttributes($attributes, $position);
        $attributes = $this->filterPresetAttributes($attributes, $position);

        if ($position == 'field' && $this->disabled) {
            $attributes = $attributes + ['disabled' => 'disabled'];
        }

        if ($position == 'field' && $this->readOnly) {
            $attributes = $attributes + ['readonly' => 'readonly'];

            if ($this->type == 'checkbox' || $this->type == 'switch') {
                $attributes = $attributes + ['onclick' => 'return false;'];
            }
        }

        return $attributes;
    }
protected function filterAttributes($attributes, $position = 'field')
    {
        $position = strtolower($position);

        $attributes = $this->filterTriggerAttributes($attributes, $position);
        $attributes = $this->filterPresetAttributes($attributes, $position);

        if ($position == 'field' && $this->disabled) {
            $attributes = $attributes + ['disabled' => 'disabled'];
        }

        if ($position == 'field' && $this->readOnly) {
            $attributes = $attributes + ['readonly' => 'readonly'];

            if ($this->type == 'checkbox' || $this->type == 'switch') {
                $attributes = $attributes + ['onclick' => 'return false;'];
            }
        }

        return $attributes;
    }
protected function filterAttributes ( $ attributes , $ position = 'field' ) { $ position = strtolower ( $ position ) ; $ attributes = $ this -> filterTriggerAttributes ( $ attributes , $ position ) ; $ attributes = $ this -> filterPresetAttributes ( $ attributes , $ position ) ; if ( $ position == 'field' && $ this -> disabled ) { $ attributes = $ attributes + [ 'disabled' => 'disabled' ] ; } if ( $ position == 'field' && $ this -> readOnly ) { $ attributes = $ attributes + [ 'readonly' => 'readonly' ] ; if ( $ this -> type == 'checkbox' || $ this -> type == 'switch' ) { $ attributes = $ attributes + [ 'onclick' => 'return false;' ] ; } } return $ attributes ; }
Adds any circumstantial attributes to the field based on other
settings, such as the 'disabled' option.
@param  array $attributes
@param  string $position
@return array
Adds any circumstantial attributes to the field based on other settings such as the disabled option .