You are here

protected function StorageManager::createField in Paragraph View Mode 2.x

Same name and namespace in other branches
  1. 8 src/StorageManager.php \Drupal\paragraph_view_mode\StorageManager::createField()

Create new field config.

Parameters

string $bundle: Paragraph entity bundle.

Throws

\Drupal\Core\Entity\EntityStorageException

1 call to StorageManager::createField()
StorageManager::addField in src/StorageManager.php
Add field to the given bundle.

File

src/StorageManager.php, line 210

Class

StorageManager
Provides fields and forms storage operations required by the module.

Namespace

Drupal\paragraph_view_mode

Code

protected function createField(string $bundle) : void {
  $field = FieldConfig::create([
    'field_storage' => $this
      ->getFieldStorage(),
    'bundle' => $bundle,
    'label' => $this
      ->t(StorageManagerInterface::FIELD_LABEL),
  ]);
  $field
    ->save();
}