original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Adds attributes used specifically by the Input Preset API
  @param  array $attributes
  @param  string $position
  @return array
docstring_tokens: Adds attributes used specifically by the Input Preset API