protected function filterPresetAttributes($attributes, $position = 'field')
    {
        if (!$this->preset || $position != 'field') {
            return $attributes;
        }

        if (!is_array($this->preset)) {
            $this->preset = ['field' => $this->preset, 'type' => 'slug'];
        }

        $presetField = array_get($this->preset, 'field');
        $presetType = array_get($this->preset, 'type');

        if ($this->arrayName) {
            $fullPresetField = $this->arrayName.'['.implode('][', HtmlHelper::nameToArray($presetField)).']';
        }
        else {
            $fullPresetField = $presetField;
        }

        $newAttributes = [
            'data-input-preset' => '[name="'.$fullPresetField.'"]',
            'data-input-preset-type' => $presetType,
            'data-input-preset-closest-parent' => 'form'
        ];

        if ($prefixInput = array_get($this->preset, 'prefixInput')) {
            $newAttributes['data-input-preset-prefix-input'] = $prefixInput;
        }

        return $attributes + $newAttributes;
    }
protected function filterPresetAttributes($attributes, $position = 'field')
    {
        if (!$this->preset || $position != 'field') {
            return $attributes;
        }

        if (!is_array($this->preset)) {
            $this->preset = ['field' => $this->preset, 'type' => 'slug'];
        }

        $presetField = array_get($this->preset, 'field');
        $presetType = array_get($this->preset, 'type');

        if ($this->arrayName) {
            $fullPresetField = $this->arrayName.'['.implode('][', HtmlHelper::nameToArray($presetField)).']';
        }
        else {
            $fullPresetField = $presetField;
        }

        $newAttributes = [
            'data-input-preset' => '[name="'.$fullPresetField.'"]',
            'data-input-preset-type' => $presetType,
            'data-input-preset-closest-parent' => 'form'
        ];

        if ($prefixInput = array_get($this->preset, 'prefixInput')) {
            $newAttributes['data-input-preset-prefix-input'] = $prefixInput;
        }

        return $attributes + $newAttributes;
    }
protected function filterPresetAttributes ( $ attributes , $ position = 'field' ) { if ( ! $ this -> preset || $ position != 'field' ) { return $ attributes ; } if ( ! is_array ( $ this -> preset ) ) { $ this -> preset = [ 'field' => $ this -> preset , 'type' => 'slug' ] ; } $ presetField = array_get ( $ this -> preset , 'field' ) ; $ presetType = array_get ( $ this -> preset , 'type' ) ; if ( $ this -> arrayName ) { $ fullPresetField = $ this -> arrayName . '[' . implode ( '][' , HtmlHelper :: nameToArray ( $ presetField ) ) . ']' ; } else { $ fullPresetField = $ presetField ; } $ newAttributes = [ 'data-input-preset' => '[name="' . $ fullPresetField . '"]' , 'data-input-preset-type' => $ presetType , 'data-input-preset-closest-parent' => 'form' ] ; if ( $ prefixInput = array_get ( $ this -> preset , 'prefixInput' ) ) { $ newAttributes [ 'data-input-preset-prefix-input' ] = $ prefixInput ; } return $ attributes + $ newAttributes ; }
Adds attributes used specifically by the Input Preset API
@param  array $attributes
@param  string $position
@return array
Adds attributes used specifically by the Input Preset API