BaseFieldOverride::createFromBaseFieldDefinition

public static BaseFieldOverride::createFromBaseFieldDefinition(BaseFieldDefinition $base_field_definition, $bundle)

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.

File

core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php, line 62

Class

BaseFieldOverride
Defines the base field override entity.

Namespace

Drupal\Core\Field\Entity

Code

public static function createFromBaseFieldDefinition(BaseFieldDefinition $base_field_definition, $bundle) {
  $values = $base_field_definition->toArray();
  $values['bundle'] = $bundle;
  $values['baseFieldDefinition'] = $base_field_definition;
  return \Drupal::entityManager()->getStorage('base_field_override')->create($values);
}
doc_Drupal
2016-10-29 08:45:51
Comments
Leave a Comment

Please login to continue.