eZ\Bundle\EzPublishCoreBundle\Features\Context\ContentTypeContext::checkContentTypeExistenceByIdentifier PHP Method

checkContentTypeExistenceByIdentifier() protected method

Verifies that a content type with $identifier exists.
protected checkContentTypeExistenceByIdentifier ( string $identifier, $groupIdentifier = null ) : boolean
$identifier string
return boolean
    protected function checkContentTypeExistenceByIdentifier($identifier, $groupIdentifier = null)
    {
        $contentType = $this->loadContentTypeByIdentifier($identifier, false);
        if ($contentType && $groupIdentifier) {
            $contentTypeGroups = $contentType->getContentTypeGroups();
            foreach ($contentTypeGroups as $contentTypeGroup) {
                if ($contentTypeGroup->identifier == $groupIdentifier) {
                    return true;
                }
            }
            return false;
        }
        return $contentType ? true : false;
    }