本文整理汇总了PHP中eZ\Publish\SPI\Persistence\Content\Type\Handler::loadContentTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Handler::loadContentTypes方法的具体用法?PHP Handler::loadContentTypes怎么用?PHP Handler::loadContentTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\SPI\Persistence\Content\Type\Handler
的用法示例。
在下文中一共展示了Handler::loadContentTypes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldMap
/**
* Get field type information
*
* Returns an array in the form:
*
* <code>
* array(
* "content-type-identifier" => array(
* "field-definition-identifier" => "field-type-identifier",
* …
* ),
* …
* )
* </code>
*
* @return array
*/
protected function getFieldMap()
{
$fieldTypes = [];
foreach ($this->contentTypeHandler->loadAllGroups() as $group) {
foreach ($this->contentTypeHandler->loadContentTypes($group->id) as $contentType) {
foreach ($contentType->fieldDefinitions as $fieldDefinition) {
if (!$fieldDefinition->isSearchable) {
continue;
}
$fieldTypes[$contentType->identifier][$fieldDefinition->identifier] = $fieldDefinition->fieldType;
}
}
}
return $fieldTypes;
}
示例2: getSortFieldTypes
/**
* Get field type information for sort clause
*
* TODO: handle custom field
* TODO: caching (see above)
*
* @param string $contentTypeIdentifier
* @param string $fieldDefinitionIdentifier
* @param string $languageCode
*
* @return array
*/
public function getSortFieldTypes($contentTypeIdentifier, $fieldDefinitionIdentifier, $languageCode)
{
$types = array();
foreach ($this->contentTypeHandler->loadAllGroups() as $group) {
foreach ($this->contentTypeHandler->loadContentTypes($group->id) as $contentType) {
if ($contentType->identifier !== $contentTypeIdentifier) {
continue;
}
foreach ($contentType->fieldDefinitions as $fieldDefinition) {
if ($fieldDefinition->identifier !== $fieldDefinitionIdentifier) {
continue;
}
// TODO: find a better way to handle non-translatable fields?
if ($languageCode === null || $fieldDefinition->isTranslatable) {
$fieldType = $this->fieldRegistry->getType($fieldDefinition->fieldType);
foreach ($fieldType->getIndexDefinition() as $name => $type) {
$types[$type->type] = $this->nameGenerator->getTypedName($this->nameGenerator->getName($name, $fieldDefinition->identifier, $contentType->identifier), $type);
}
}
break 3;
}
}
}
return $types;
}
示例3: loadContentTypes
/**
* Get Content Type objects which belong to the given content type group
*
* @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup
*
* @return \eZ\Publish\API\Repository\Values\ContentType\ContentType[] Which have status DEFINED
*/
public function loadContentTypes(APIContentTypeGroup $contentTypeGroup)
{
$spiContentTypes = $this->contentTypeHandler->loadContentTypes($contentTypeGroup->id, SPIContentType::STATUS_DEFINED);
$contentTypes = array();
foreach ($spiContentTypes as $spiContentType) {
$contentTypes[] = $this->buildContentTypeDomainObject($spiContentType);
}
return $contentTypes;
}
示例4: loadContentTypes
/**
* Get Content Type objects which belong to the given content type group.
*
* @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup
*
* @return \eZ\Publish\API\Repository\Values\ContentType\ContentType[] Which have status DEFINED
*/
public function loadContentTypes(APIContentTypeGroup $contentTypeGroup)
{
$spiContentTypes = $this->contentTypeHandler->loadContentTypes($contentTypeGroup->id, SPIContentType::STATUS_DEFINED);
$contentTypes = array();
foreach ($spiContentTypes as $spiContentType) {
$contentTypes[] = $this->contentTypeDomainMapper->buildContentTypeDomainObject($spiContentType, array_map(function ($id) {
return $this->contentTypeHandler->loadGroup($id);
}, $spiContentType->groupIds));
}
return $contentTypes;
}
示例5: getFieldTypes
/**
* Get field type information
*
* Returns an array in the form:
*
* <code>
* array(
* "field-identifier" => array(
* "solr_field_name",
* …
* ),
* …
* )
* </code>
*
* @param \eZ\Publish\API\Repository\Values\Content\Query\CustomFieldInterface $criterion
*
* @return array
*/
public function getFieldTypes(CustomFieldInterface $criterion)
{
// @TODO: temp fixed by disabling caching, see https://jira.ez.no/browse/EZP-22834
$this->fieldTypes = array();
foreach ($this->contentTypeHandler->loadAllGroups() as $group) {
foreach ($this->contentTypeHandler->loadContentTypes($group->id) as $contentType) {
foreach ($contentType->fieldDefinitions as $fieldDefinition) {
if (!$fieldDefinition->isSearchable) {
continue;
}
if ($customField = $criterion->getCustomField($contentType->identifier, $fieldDefinition->identifier)) {
$this->fieldTypes[$fieldDefinition->identifier]["custom"][] = $customField;
continue;
}
$fieldType = $this->fieldRegistry->getType($fieldDefinition->fieldType);
foreach ($fieldType->getIndexDefinition() as $name => $type) {
$this->fieldTypes[$fieldDefinition->identifier][$type->type][] = $this->nameGenerator->getTypedName($this->nameGenerator->getName($name, $fieldDefinition->identifier, $contentType->identifier), $type);
}
}
}
}
return $this->fieldTypes;
}
示例6: loadContentTypes
/**
* @param mixed $groupId
* @param int $status
* @return Type[]
*/
public function loadContentTypes($groupId, $status = 0)
{
return $this->innerHandler->loadContentTypes($groupId, $status);
}