original_string: protected function filterTriggerAttributes($attributes, $position = 'field')
      {
          if (!$this->trigger || !is_array($this->trigger)) {
              return $attributes;
          }
  
          $triggerAction = array_get($this->trigger, 'action');
          $triggerField = array_get($this->trigger, 'field');
          $triggerCondition = array_get($this->trigger, 'condition');
          $triggerForm = $this->arrayName;
          $triggerMulti = '';
  
          // Apply these to container
          if (in_array($triggerAction, ['hide', 'show']) && $position != 'container') {
              return $attributes;
          }
  
          // Apply these to field/input
          if (in_array($triggerAction, ['enable', 'disable', 'empty']) && $position != 'field') {
              return $attributes;
          }
  
          // Reduce the field reference for the trigger condition field
          $triggerFieldParentLevel = Str::getPrecedingSymbols($triggerField, self::HIERARCHY_UP);
          if ($triggerFieldParentLevel > 0) {
              // Remove the preceding symbols from the trigger field name
              $triggerField = substr($triggerField, $triggerFieldParentLevel);
              $triggerForm = HtmlHelper::reduceNameHierarchy($triggerForm, $triggerFieldParentLevel);
          }
  
          // Preserve multi field types
          if (Str::endsWith($triggerField, '[]')) {
              $triggerField = substr($triggerField, 0, -2);
              $triggerMulti = '[]';
          }
  
          // Final compilation
          if ($this->arrayName) {
              $fullTriggerField = $triggerForm.'['.implode('][', HtmlHelper::nameToArray($triggerField)).']'.$triggerMulti;
          }
          else {
              $fullTriggerField = $triggerField.$triggerMulti;
          }
  
          $newAttributes = [
              'data-trigger' => '[name="'.$fullTriggerField.'"]',
              'data-trigger-action' => $triggerAction,
              'data-trigger-condition' => $triggerCondition,
              'data-trigger-closest-parent' => 'form, div[data-control="formwidget"]'
          ];
  
          return $attributes + $newAttributes;
      }
code: protected function filterTriggerAttributes($attributes, $position = 'field')
      {
          if (!$this->trigger || !is_array($this->trigger)) {
              return $attributes;
          }
  
          $triggerAction = array_get($this->trigger, 'action');
          $triggerField = array_get($this->trigger, 'field');
          $triggerCondition = array_get($this->trigger, 'condition');
          $triggerForm = $this->arrayName;
          $triggerMulti = '';
  
          // Apply these to container
          if (in_array($triggerAction, ['hide', 'show']) && $position != 'container') {
              return $attributes;
          }
  
          // Apply these to field/input
          if (in_array($triggerAction, ['enable', 'disable', 'empty']) && $position != 'field') {
              return $attributes;
          }
  
          // Reduce the field reference for the trigger condition field
          $triggerFieldParentLevel = Str::getPrecedingSymbols($triggerField, self::HIERARCHY_UP);
          if ($triggerFieldParentLevel > 0) {
              // Remove the preceding symbols from the trigger field name
              $triggerField = substr($triggerField, $triggerFieldParentLevel);
              $triggerForm = HtmlHelper::reduceNameHierarchy($triggerForm, $triggerFieldParentLevel);
          }
  
          // Preserve multi field types
          if (Str::endsWith($triggerField, '[]')) {
              $triggerField = substr($triggerField, 0, -2);
              $triggerMulti = '[]';
          }
  
          // Final compilation
          if ($this->arrayName) {
              $fullTriggerField = $triggerForm.'['.implode('][', HtmlHelper::nameToArray($triggerField)).']'.$triggerMulti;
          }
          else {
              $fullTriggerField = $triggerField.$triggerMulti;
          }
  
          $newAttributes = [
              'data-trigger' => '[name="'.$fullTriggerField.'"]',
              'data-trigger-action' => $triggerAction,
              'data-trigger-condition' => $triggerCondition,
              'data-trigger-closest-parent' => 'form, div[data-control="formwidget"]'
          ];
  
          return $attributes + $newAttributes;
      }
code_tokens: protected function filterTriggerAttributes ( $ attributes , $ position = 'field' ) { if ( ! $ this -> trigger || ! is_array ( $ this -> trigger ) ) { return $ attributes ; } $ triggerAction = array_get ( $ this -> trigger , 'action' ) ; $ triggerField = array_get ( $ this -> trigger , 'field' ) ; $ triggerCondition = array_get ( $ this -> trigger , 'condition' ) ; $ triggerForm = $ this -> arrayName ; $ triggerMulti = '' ; // Apply these to container if ( in_array ( $ triggerAction , [ 'hide' , 'show' ] ) && $ position != 'container' ) { return $ attributes ; } // Apply these to field/input if ( in_array ( $ triggerAction , [ 'enable' , 'disable' , 'empty' ] ) && $ position != 'field' ) { return $ attributes ; } // Reduce the field reference for the trigger condition field $ triggerFieldParentLevel = Str :: getPrecedingSymbols ( $ triggerField , self :: HIERARCHY_UP ) ; if ( $ triggerFieldParentLevel > 0 ) { // Remove the preceding symbols from the trigger field name $ triggerField = substr ( $ triggerField , $ triggerFieldParentLevel ) ; $ triggerForm = HtmlHelper :: reduceNameHierarchy ( $ triggerForm , $ triggerFieldParentLevel ) ; } // Preserve multi field types if ( Str :: endsWith ( $ triggerField , '[]' ) ) { $ triggerField = substr ( $ triggerField , 0 , - 2 ) ; $ triggerMulti = '[]' ; } // Final compilation if ( $ this -> arrayName ) { $ fullTriggerField = $ triggerForm . '[' . implode ( '][' , HtmlHelper :: nameToArray ( $ triggerField ) ) . ']' . $ triggerMulti ; } else { $ fullTriggerField = $ triggerField . $ triggerMulti ; } $ newAttributes = [ 'data-trigger' => '[name="' . $ fullTriggerField . '"]' , 'data-trigger-action' => $ triggerAction , 'data-trigger-condition' => $ triggerCondition , 'data-trigger-closest-parent' => 'form, div[data-control="formwidget"]' ] ; return $ attributes + $ newAttributes ; }
docstring: Adds attributes used specifically by the Trigger API
  @param  array $attributes
  @param  string $position
  @return array
docstring_tokens: Adds attributes used specifically by the Trigger API