本文整理汇总了PHP中Drupal\Core\Field\FieldStorageDefinitionInterface::getProvider方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldStorageDefinitionInterface::getProvider方法的具体用法?PHP FieldStorageDefinitionInterface::getProvider怎么用?PHP FieldStorageDefinitionInterface::getProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Field\FieldStorageDefinitionInterface
的用法示例。
在下文中一共展示了FieldStorageDefinitionInterface::getProvider方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFromFieldStorageDefinition
/**
* Creates a new field definition based upon a field storage definition.
*
* In cases where one needs a field storage definitions to act like full
* field definitions, this creates a new field definition based upon the
* (limited) information available. That way it is possible to use the field
* definition in places where a full field definition is required; e.g., with
* widgets or formatters.
*
* @param \Drupal\Core\Field\FieldStorageDefinitionInterface $definition
* The field storage definition to base the new field definition upon.
*
* @return $this
*/
public static function createFromFieldStorageDefinition(FieldStorageDefinitionInterface $definition)
{
return static::create($definition->getType())->setCardinality($definition->getCardinality())->setConstraints($definition->getConstraints())->setCustomStorage($definition->hasCustomStorage())->setDescription($definition->getDescription())->setLabel($definition->getLabel())->setName($definition->getName())->setProvider($definition->getProvider())->setQueryable($definition->isQueryable())->setRequired($definition->isRequired())->setRevisionable($definition->isRevisionable())->setSettings($definition->getSettings())->setTargetEntityTypeId($definition->getTargetEntityTypeId())->setTranslatable($definition->isTranslatable());
}
示例2: usesDedicatedTable
/**
* Returns whether the field uses a dedicated table for storage.
*
* @param FieldStorageDefinitionInterface $definition
* The field storage definition.
*
* @return bool
* Whether the field uses a dedicated table for storage.
*/
protected function usesDedicatedTable(FieldStorageDefinitionInterface $definition)
{
// Everything that is not provided by the entity type is stored in a
// dedicated table.
return $definition->getProvider() != $this->entityType->getProvider() && !$definition->hasCustomStorage();
}