original_string: protected function enrichField($key, ModelFormFieldDataInterface $field, array &$fields)
      {
          $normalizedRelationName = $this->normalizeRelationName($key);
  
          // Check if we can enrich, if we must.
          if (    ! isset($this->info->attributes[ $key ])
              &&  ! isset($this->info->relations[ $normalizedRelationName ])
          ) {
              // Make sure to set the key if it isn't
              if ( ! $field->key()) {
                  $field->key = $key;
              }
  
              $fields[ $key ] = $field;
              return;
          }
  
          if (isset($this->info->attributes[ $key ])) {
              $enrichFieldInfo = $this->makeModelFormFieldDataForAttributeData($this->info->attributes[ $key ]);
          } else {
              // get from relation data
              $enrichFieldInfo = $this->makeModelFormFieldDataForRelationData(
                  $this->info->relations[ $normalizedRelationName ],
                  $key
              );
          }
  
          // Detect whether update/create were not explicitly defined
          // If they were not, assume that they should be shown,
          // since they were explicitly included in the config.
          if (null === $field->update && null === $field->create) {
              $field->update = true;
              $field->create = true;
          }
  
          $enrichFieldInfo->merge($field);
  
          $fields[ $key ] = $enrichFieldInfo;
      }
code: protected function enrichField($key, ModelFormFieldDataInterface $field, array &$fields)
      {
          $normalizedRelationName = $this->normalizeRelationName($key);
  
          // Check if we can enrich, if we must.
          if (    ! isset($this->info->attributes[ $key ])
              &&  ! isset($this->info->relations[ $normalizedRelationName ])
          ) {
              // Make sure to set the key if it isn't
              if ( ! $field->key()) {
                  $field->key = $key;
              }
  
              $fields[ $key ] = $field;
              return;
          }
  
          if (isset($this->info->attributes[ $key ])) {
              $enrichFieldInfo = $this->makeModelFormFieldDataForAttributeData($this->info->attributes[ $key ]);
          } else {
              // get from relation data
              $enrichFieldInfo = $this->makeModelFormFieldDataForRelationData(
                  $this->info->relations[ $normalizedRelationName ],
                  $key
              );
          }
  
          // Detect whether update/create were not explicitly defined
          // If they were not, assume that they should be shown,
          // since they were explicitly included in the config.
          if (null === $field->update && null === $field->create) {
              $field->update = true;
              $field->create = true;
          }
  
          $enrichFieldInfo->merge($field);
  
          $fields[ $key ] = $enrichFieldInfo;
      }
code_tokens: protected function enrichField ( $ key , ModelFormFieldDataInterface $ field , array & $ fields ) { $ normalizedRelationName = $ this -> normalizeRelationName ( $ key ) ; // Check if we can enrich, if we must. if ( ! isset ( $ this -> info -> attributes [ $ key ] ) && ! isset ( $ this -> info -> relations [ $ normalizedRelationName ] ) ) { // Make sure to set the key if it isn't if ( ! $ field -> key ( ) ) { $ field -> key = $ key ; } $ fields [ $ key ] = $ field ; return ; } if ( isset ( $ this -> info -> attributes [ $ key ] ) ) { $ enrichFieldInfo = $ this -> makeModelFormFieldDataForAttributeData ( $ this -> info -> attributes [ $ key ] ) ; } else { // get from relation data $ enrichFieldInfo = $ this -> makeModelFormFieldDataForRelationData ( $ this -> info -> relations [ $ normalizedRelationName ] , $ key ) ; } // Detect whether update/create were not explicitly defined // If they were not, assume that they should be shown, // since they were explicitly included in the config. if ( null === $ field -> update && null === $ field -> create ) { $ field -> update = true ; $ field -> create = true ; } $ enrichFieldInfo -> merge ( $ field ) ; $ fields [ $ key ] = $ enrichFieldInfo ; }
docstring: Enriches a single form field and saves the data.
  
  @param ModelFormFieldDataInterface|ModelFormFieldData $field
  @param string                                         $key
  @param array                                          $fields by reference, data array to build, updated with enriched data
docstring_tokens: Enriches a single form field and saves the data .