eZ\Publish\Core\REST\Server\Controller\ContentType::loadContentTypeFieldDefinition PHP Method

loadContentTypeFieldDefinition() public method

Returns the field definition given by id.
public loadContentTypeFieldDefinition ( $contentTypeId, $fieldDefinitionId, Request $request ) : RestFieldDefinition
$contentTypeId
$fieldDefinitionId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\RestFieldDefinition
    public function loadContentTypeFieldDefinition($contentTypeId, $fieldDefinitionId, Request $request)
    {
        $contentType = $this->contentTypeService->loadContentType($contentTypeId);
        foreach ($contentType->getFieldDefinitions() as $fieldDefinition) {
            if ($fieldDefinition->id == $fieldDefinitionId) {
                return new Values\RestFieldDefinition($contentType, $fieldDefinition);
            }
        }
        throw new Exceptions\NotFoundException("Field definition not found: '{$request->getPathInfo()}'.");
    }