function BaseFieldOverride::createFromBaseFieldDefinition
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php \Drupal\Core\Field\Entity\BaseFieldOverride::createFromBaseFieldDefinition()
- 8.9.x core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php \Drupal\Core\Field\Entity\BaseFieldOverride::createFromBaseFieldDefinition()
- 11.x core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php \Drupal\Core\Field\Entity\BaseFieldOverride::createFromBaseFieldDefinition()
Creates a base field override object.
Parameters
\Drupal\Core\Field\BaseFieldDefinition $base_field_definition: The base field definition to override.
string $bundle: The bundle to which the override applies.
Return value
\Drupal\Core\Field\Entity\BaseFieldOverride A new base field override object.
5 calls to BaseFieldOverride::createFromBaseFieldDefinition()
- BaseFieldDefinition::getConfig in core/
lib/ Drupal/ Core/ Field/ BaseFieldDefinition.php - BaseFieldOverrideTest::testDefaultValueCallback in core/
tests/ Drupal/ KernelTests/ Core/ Field/ Entity/ BaseFieldOverrideTest.php - Tests the default value callback.
- BaseFieldOverrideTest::testGetClass in core/
tests/ Drupal/ KernelTests/ Core/ Field/ Entity/ BaseFieldOverrideTest.php - @covers ::getClass
- BaseFieldOverrideTest::testInheritedProperties in core/
tests/ Drupal/ KernelTests/ Core/ Field/ Entity/ BaseFieldOverrideTest.php - Tests that some properties are inherited from the BaseFieldDefinition.
- BaseFieldOverrideValidationTest::setUp in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ BaseFieldOverrideValidationTest.php
File
-
core/
lib/ Drupal/ Core/ Field/ Entity/ BaseFieldOverride.php, line 71
Class
- BaseFieldOverride
- Defines the base field override entity.
Namespace
Drupal\Core\Field\EntityCode
public static function createFromBaseFieldDefinition(BaseFieldDefinition $base_field_definition, $bundle) {
$values = $base_field_definition->toArray();
$values['bundle'] = $bundle;
$values['baseFieldDefinition'] = $base_field_definition;
return \Drupal::entityTypeManager()->getStorage('base_field_override')
->create($values);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.