public function FieldTypePluginManager::createFieldItemList in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Field/FieldTypePluginManager.php \Drupal\Core\Field\FieldTypePluginManager::createFieldItemList()
Creates a new field item list.
The provided entity is assigned as the parent of the created item list. However, it is the responsibility of the caller (usually the parent entity itself) to make the parent aware of the field as a new child.
Parameters
\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity this field item list will be part of.
string $field_name: The name of the field.
mixed $values: (optional) The data value. If set, it has to match one of the supported data type format as documented for the data type classes.
Return value
\Drupal\Core\Field\FieldItemListInterface The instantiated object.
Overrides FieldTypePluginManagerInterface::createFieldItemList
File
- core/
lib/ Drupal/ Core/ Field/ FieldTypePluginManager.php, line 72
Class
- FieldTypePluginManager
- Plugin manager for 'field type' plugins.
Namespace
Drupal\Core\FieldCode
public function createFieldItemList(FieldableEntityInterface $entity, $field_name, $values = NULL) {
// Leverage prototyping of the Typed Data API for fast instantiation.
return $this->typedDataManager
->getPropertyInstance($entity
->getTypedData(), $field_name, $values);
}