Rest/Field/Value.php
private function getImageFieldIdentifier($contentId, $language, $related = false)
    {
        $content = $this->contentService->loadContent($contentId);
        $contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);

        $fieldDefinitions = $this->getFieldDefinitionList();
        $fieldNames = array_flip($fieldDefinitions);

        if (in_array('ezimage', $fieldDefinitions)) {
            return $fieldNames['ezimage'];
        } elseif (in_array('ezobjectrelation', $fieldDefinitions) && !$related) {
            $field = $content->getFieldValue($fieldNames['ezobjectrelation'], $language);

            if (!empty($field->destinationContentId)) {
                return $this->getImageFieldIdentifier($field->destinationContentId, $language, true);
            }
        } else {
            return $this->getConfiguredFieldIdentifier('image', $contentType);
        }
    }
private function getImageFieldIdentifier($contentId, $language, $related = false)
    {
        $content = $this->contentService->loadContent($contentId);
        $contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);

        $fieldDefinitions = $this->getFieldDefinitionList();
        $fieldNames = array_flip($fieldDefinitions);

        if (in_array('ezimage', $fieldDefinitions)) {
            return $fieldNames['ezimage'];
        } elseif (in_array('ezobjectrelation', $fieldDefinitions) && !$related) {
            $field = $content->getFieldValue($fieldNames['ezobjectrelation'], $language);

            if (!empty($field->destinationContentId)) {
                return $this->getImageFieldIdentifier($field->destinationContentId, $language, true);
            }
        } else {
            return $this->getConfiguredFieldIdentifier('image', $contentType);
        }
    }
private function getImageFieldIdentifier ( $ contentId , $ language , $ related = false ) { $ content = $ this -> contentService -> loadContent ( $ contentId ) ; $ contentType = $ this -> contentTypeService -> loadContentType ( $ content -> contentInfo -> contentTypeId ) ; $ fieldDefinitions = $ this -> getFieldDefinitionList ( ) ; $ fieldNames = array_flip ( $ fieldDefinitions ) ; if ( in_array ( 'ezimage' , $ fieldDefinitions ) ) { return $ fieldNames [ 'ezimage' ] ; } elseif ( in_array ( 'ezobjectrelation' , $ fieldDefinitions ) && ! $ related ) { $ field = $ content -> getFieldValue ( $ fieldNames [ 'ezobjectrelation' ] , $ language ) ; if ( ! empty ( $ field -> destinationContentId ) ) { return $ this -> getImageFieldIdentifier ( $ field -> destinationContentId , $ language , true ) ; } } else { return $ this -> getConfiguredFieldIdentifier ( 'image' , $ contentType ) ; } }
Return identifier of a field of ezimage type.

@param mixed $contentId
@param string $language
@param bool $related

@return string
Return identifier of a field of ezimage type .