本文整理匯總了PHP中eZ\Publish\SPI\Persistence\Content\Type\Handler::getFieldDefinition方法的典型用法代碼示例。如果您正苦於以下問題:PHP Handler::getFieldDefinition方法的具體用法?PHP Handler::getFieldDefinition怎麽用?PHP Handler::getFieldDefinition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZ\Publish\SPI\Persistence\Content\Type\Handler
的用法示例。
在下文中一共展示了Handler::getFieldDefinition方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getFieldDefinition
/**
* Returns field definition for the given field definition id
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If field definition is not found
*
* @param mixed $id
* @param int $status One of Type::STATUS_DEFINED|Type::STATUS_DRAFT|Type::STATUS_MODIFIED
*
* @return \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition
*/
public function getFieldDefinition($id, $status)
{
if (isset($this->fieldDefinitions[$id][$status])) {
return $this->fieldDefinitions[$id][$status];
}
return $this->fieldDefinitions[$id][$status] = $this->innerHandler->getFieldDefinition($id, $status);
}
示例2: getFullTextValues
/**
* Returns an array of FullTextValue object containing searchable values of content object
* fields for the given $content.
*
* @param \eZ\Publish\SPI\Persistence\Content $content
*
* @return \eZ\Publish\Core\Search\Legacy\Content\FullTextValue[]
*/
protected function getFullTextValues(Content $content)
{
$fullTextValues = [];
foreach ($content->fields as $field) {
$fieldDefinition = $this->contentTypeHandler->getFieldDefinition($field->fieldDefinitionId, Content\Type::STATUS_DEFINED);
if (!$fieldDefinition->isSearchable) {
continue;
}
$value = $this->getFullTextFieldValue($field, $fieldDefinition);
if (empty($value)) {
continue;
}
$fullTextValues[] = new FullTextValue(['id' => $field->id, 'fieldDefinitionId' => $field->fieldDefinitionId, 'fieldDefinitionIdentifier' => $fieldDefinition->identifier, 'languageCode' => $field->languageCode, 'value' => !is_array($value) ? $value : implode(' ', $value)]);
}
return $fullTextValues;
}