You are here

public static function FieldDefinition::createFromFieldStorageDefinition in Drupal 8

Same name and namespace in other branches
  1. 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

2 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.

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