You are here

protected function TransactorBase::createFieldStorage in Transaction 8

Creates a new field.

Parameters

string $field_name: The field name.

array $field_info: The field info array as defined in the transactor plugin.

Return value

\Drupal\field\Entity\FieldStorageConfig The new (saved) field storage object.

1 call to TransactorBase::createFieldStorage()
TransactorBase::submitConfigurationForm in src/TransactorBase.php
Handles the settings form submit for this transactor plugin.

File

src/TransactorBase.php, line 556

Class

TransactorBase
Provides a base class for transactor plugins.

Namespace

Drupal\transaction

Code

protected function createFieldStorage($field_name, array $field_info) {

  // Field storage.
  $new_field = FieldStorageConfig::create([
    'field_name' => $field_name,
    'entity_type' => $field_info['entity_type'],
    'type' => $field_info['type'],
    'settings' => $field_info['settings'],
  ]);
  $new_field
    ->save();
  return $new_field;
}