本文整理汇总了PHP中Drupal\Core\TypedData\TypedDataManager::createInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP TypedDataManager::createInstance方法的具体用法?PHP TypedDataManager::createInstance怎么用?PHP TypedDataManager::createInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\TypedData\TypedDataManager
的用法示例。
在下文中一共展示了TypedDataManager::createInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createInstance
/**
* {@inheritdoc}
*/
public function createInstance($data_type, array $configuration = array())
{
$instance = parent::createInstance($data_type, $configuration);
// Enable elements to construct their own definitions using the typed config
// manager.
if ($instance instanceof ArrayElement) {
$instance->setTypedConfig($this);
}
return $instance;
}
示例2: createInstance
/**
* {@inheritdoc}
*
* Creates a field item, which is not part of an entity or field item list.
*
* @param string $field_type
* The field type, for which a field item should be created.
* @param array $configuration
* The plugin configuration array, i.e. an array with the following keys:
* - field_definition: The field definition object, i.e. an instance of
* Drupal\Core\Field\FieldDefinitionInterface.
*
* @return \Drupal\Core\Field\FieldItemInterface
* The instantiated object.
*/
public function createInstance($field_type, array $configuration = array())
{
$configuration['data_definition'] = $configuration['field_definition']->getItemDefinition();
return $this->typedDataManager->createInstance("field_item:{$field_type}", $configuration);
}