You are here

public function ManagerForm::createFieldStorage in Hashtags 8

1 call to ManagerForm::createFieldStorage()
ManagerForm::addField in src/Form/ManagerForm.php

File

src/Form/ManagerForm.php, line 148

Class

ManagerForm

Namespace

Drupal\hashtags\Form

Code

public function createFieldStorage($entity_type, $field_name) {
  $field_storage = FieldStorageConfig::create(array(
    'field_name' => $field_name,
    'entity_type' => $entity_type,
    'type' => 'entity_reference',
    'settings' => array(
      'target_type' => 'taxonomy_term',
    ),
    'cardinality' => -1,
    'locked' => false,
    'translatable' => true,
  ));
  $field_storage
    ->save();
  return $field_storage;
}