protected function contentTypeHasFieldDefinition(ContentType $contentType, $fieldIdentifier)
    {
        $existingFieldDefinitions = $contentType->fieldDefinitions;

        foreach ($existingFieldDefinitions as $existingFieldDefinition) {
            if ($fieldIdentifier == $existingFieldDefinition->identifier) {
                return $existingFieldDefinition;
            }
        }

        return null;
    }
protected function contentTypeHasFieldDefinition(ContentType $contentType, $fieldIdentifier)
    {
        $existingFieldDefinitions = $contentType->fieldDefinitions;

        foreach ($existingFieldDefinitions as $existingFieldDefinition) {
            if ($fieldIdentifier == $existingFieldDefinition->identifier) {
                return $existingFieldDefinition;
            }
        }

        return null;
    }
protected function contentTypeHasFieldDefinition ( ContentType $ contentType , $ fieldIdentifier ) { $ existingFieldDefinitions = $ contentType -> fieldDefinitions ; foreach ( $ existingFieldDefinitions as $ existingFieldDefinition ) { if ( $ fieldIdentifier == $ existingFieldDefinition -> identifier ) { return $ existingFieldDefinition ; } } return null ; }
Helper to find out if a Field is already defined in a ContentType

@param ContentType $contentType
@param string $fieldIdentifier
@return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition|null
Helper to find out if a Field is already defined in a ContentType