original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Adds any circumstantial attributes to the field based on other
  settings, such as the 'disabled' option.
  @param  array $attributes
  @param  string $position
  @return array
docstring_tokens: Adds any circumstantial attributes to the field based on other settings such as the disabled option .