You are here

public static function FieldDefinition::createFromFieldStorageDefinition in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Field/FieldDefinition.php \Drupal\Core\Field\FieldDefinition::createFromFieldStorageDefinition()
  2. 9 core/lib/Drupal/Core/Field/FieldDefinition.php \Drupal\Core\Field\FieldDefinition::createFromFieldStorageDefinition()

Creates a new field definition.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $storageDefinition: The associated field storage definition.

Return value

static

3 calls to FieldDefinition::createFromFieldStorageDefinition()
entity_schema_test_entity_bundle_field_info in core/modules/system/tests/modules/entity_schema_test/entity_schema_test.module
Implements hook_entity_bundle_field_info().
FieldDefinitionTest::initializeFieldUsingFactory in core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
Creates a bundle field using a specified factory.
hook_entity_bundle_field_info in core/lib/Drupal/Core/Entity/entity.api.php
Provides field definitions for a specific bundle within an entity type.

File

core/lib/Drupal/Core/Field/FieldDefinition.php, line 55

Class

FieldDefinition
A class for defining entity field definitions.

Namespace

Drupal\Core\Field

Code

public static function createFromFieldStorageDefinition(FieldStorageDefinitionInterface $storageDefinition) {
  $field_definition = new static();
  $field_definition
    ->setFieldStorageDefinition($storageDefinition);
  return $field_definition;
}