protected function enrichField($key, ModelShowFieldDataInterface $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 ])
        ) {
            // If the field data is fully set, no need to enrich
            if ($this->isShowFieldDataComplete($field)) {
                $fields[ $key ] = $field;
                return;
            }

            throw new UnexpectedValueException(
                "Incomplete data for for show field key that does not match known model attribute or relation method. "
                . "Requires at least 'source' and 'strategy' values."
            );
        }

        if (isset($this->info->attributes[ $key ])) {
            $attributeFieldInfo = $this->makeModelShowFieldDataForAttributeData($this->info->attributes[ $key ], $this->info);
        } else {
            // get from relation data
            $attributeFieldInfo = $this->makeModelShowFieldDataForRelationData(
                $this->info->relations[ $normalizedRelationName ],
                $this->info
            );
        }

        $attributeFieldInfo->merge($field);

        $fields[ $key ] = $attributeFieldInfo;
    }
protected function enrichField($key, ModelShowFieldDataInterface $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 ])
        ) {
            // If the field data is fully set, no need to enrich
            if ($this->isShowFieldDataComplete($field)) {
                $fields[ $key ] = $field;
                return;
            }

            throw new UnexpectedValueException(
                "Incomplete data for for show field key that does not match known model attribute or relation method. "
                . "Requires at least 'source' and 'strategy' values."
            );
        }

        if (isset($this->info->attributes[ $key ])) {
            $attributeFieldInfo = $this->makeModelShowFieldDataForAttributeData($this->info->attributes[ $key ], $this->info);
        } else {
            // get from relation data
            $attributeFieldInfo = $this->makeModelShowFieldDataForRelationData(
                $this->info->relations[ $normalizedRelationName ],
                $this->info
            );
        }

        $attributeFieldInfo->merge($field);

        $fields[ $key ] = $attributeFieldInfo;
    }
protected function enrichField ( $ key , ModelShowFieldDataInterface $ 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 ] ) ) { // If the field data is fully set, no need to enrich if ( $ this -> isShowFieldDataComplete ( $ field ) ) { $ fields [ $ key ] = $ field ; return ; } throw new UnexpectedValueException ( "Incomplete data for for show field key that does not match known model attribute or relation method. " . "Requires at least 'source' and 'strategy' values." ) ; } if ( isset ( $ this -> info -> attributes [ $ key ] ) ) { $ attributeFieldInfo = $ this -> makeModelShowFieldDataForAttributeData ( $ this -> info -> attributes [ $ key ] , $ this -> info ) ; } else { // get from relation data $ attributeFieldInfo = $ this -> makeModelShowFieldDataForRelationData ( $ this -> info -> relations [ $ normalizedRelationName ] , $ this -> info ) ; } $ attributeFieldInfo -> merge ( $ field ) ; $ fields [ $ key ] = $ attributeFieldInfo ; }
Enriches a single show field and saves the data.

@param ModelShowFieldDataInterface $field
@param string                      $key
@param array                       $fields       by reference, data array to build, updated with enriched data
Enriches a single show field and saves the data .