本文整理汇总了PHP中Drupal\Core\Field\BaseFieldDefinition::createFromFieldStorageDefinition方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseFieldDefinition::createFromFieldStorageDefinition方法的具体用法?PHP BaseFieldDefinition::createFromFieldStorageDefinition怎么用?PHP BaseFieldDefinition::createFromFieldStorageDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Field\BaseFieldDefinition
的用法示例。
在下文中一共展示了BaseFieldDefinition::createFromFieldStorageDefinition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldDefinition
/**
* Gets the field definition.
*
* A View works on an entity type across bundles, and thus only has access to
* field storage definitions. In order to be able to use widgets and
* formatters, we create a generic field definition out of that storage
* definition.
*
* @see BaseFieldDefinition::createFromFieldStorageDefinition()
*
* @return \Drupal\Core\Field\FieldDefinitionInterface
* The field definition used by this handler.
*/
protected function getFieldDefinition()
{
if (!$this->fieldDefinition) {
$field_storage_config = $this->getFieldStorageDefinition();
$this->fieldDefinition = BaseFieldDefinition::createFromFieldStorageDefinition($field_storage_config);
}
return $this->fieldDefinition;
}