function FieldDefinition::createFromFieldStorageDefinition

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/FieldDefinition.php \Drupal\Core\Field\FieldDefinition::createFromFieldStorageDefinition()
  2. 8.9.x core/lib/Drupal/Core/Field/FieldDefinition.php \Drupal\Core\Field\FieldDefinition::createFromFieldStorageDefinition()
  3. 10 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()
EntitySchemaTestHooks::entityBundleFieldInfo in core/modules/system/tests/modules/entity_schema_test/src/Hook/EntitySchemaTestHooks.php
Implements hook_entity_bundle_field_info().
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.

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.