protected function _isDisabled(array $options)
    {
        if (!isset($options['disabled'])) {
            return false;
        }
        if (is_scalar($options['disabled'])) {
            return ($options['disabled'] === true || $options['disabled'] === 'disabled');
        }
        if (!isset($options['options'])) {
            return false;
        }
        if (is_array($options['options'])) {
            // Simple list options
            $first = $options['options'][array_keys($options['options'])[0]];
            if (is_scalar($first)) {
                return array_diff($options['options'], $options['disabled']) === [];
            }
            // Complex option types
            if (is_array($first)) {
                $disabled = array_filter($options['options'], function ($i) use ($options) {
                    return in_array($i['value'], $options['disabled']);
                });

                return count($disabled) > 0;
            }
        }

        return false;
    }
protected function _isDisabled(array $options)
    {
        if (!isset($options['disabled'])) {
            return false;
        }
        if (is_scalar($options['disabled'])) {
            return ($options['disabled'] === true || $options['disabled'] === 'disabled');
        }
        if (!isset($options['options'])) {
            return false;
        }
        if (is_array($options['options'])) {
            // Simple list options
            $first = $options['options'][array_keys($options['options'])[0]];
            if (is_scalar($first)) {
                return array_diff($options['options'], $options['disabled']) === [];
            }
            // Complex option types
            if (is_array($first)) {
                $disabled = array_filter($options['options'], function ($i) use ($options) {
                    return in_array($i['value'], $options['disabled']);
                });

                return count($disabled) > 0;
            }
        }

        return false;
    }
protected function _isDisabled ( array $ options ) { if ( ! isset ( $ options [ 'disabled' ] ) ) { return false ; } if ( is_scalar ( $ options [ 'disabled' ] ) ) { return ( $ options [ 'disabled' ] === true || $ options [ 'disabled' ] === 'disabled' ) ; } if ( ! isset ( $ options [ 'options' ] ) ) { return false ; } if ( is_array ( $ options [ 'options' ] ) ) { // Simple list options $ first = $ options [ 'options' ] [ array_keys ( $ options [ 'options' ] ) [ 0 ] ] ; if ( is_scalar ( $ first ) ) { return array_diff ( $ options [ 'options' ] , $ options [ 'disabled' ] ) === [ ] ; } // Complex option types if ( is_array ( $ first ) ) { $ disabled = array_filter ( $ options [ 'options' ] , function ( $ i ) use ( $ options ) { return in_array ( $ i [ 'value' ] , $ options [ 'disabled' ] ) ; } ) ; return count ( $ disabled ) > 0 ; } } return false ; }
Determine if a field is disabled.

@param array $options The option set.
@return bool Whether or not the field is disabled.
Determine if a field is disabled .