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

publishContentTypeDraft() public method

Publishes a content type draft.
public publishContentTypeDraft ( $contentTypeId ) : RestContentType
$contentTypeId
return eZ\Publish\Core\REST\Server\Values\RestContentType
    public function publishContentTypeDraft($contentTypeId)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
        $fieldDefinitions = $contentTypeDraft->getFieldDefinitions();
        if (empty($fieldDefinitions)) {
            throw new ForbiddenException('Empty content type draft cannot be published');
        }
        $this->contentTypeService->publishContentTypeDraft($contentTypeDraft);
        $publishedContentType = $this->contentTypeService->loadContentType($contentTypeDraft->id);
        return new Values\RestContentType($publishedContentType, $publishedContentType->getFieldDefinitions());
    }