You are here

protected function AcquiadamAsset::createSourceFieldStorage in Media: Acquia DAM 8

Creates the source field storage definition.

By default, the first field type listed in the plugin definition's allowed_field_types array will be the generated field's type.

Return value

\Drupal\field\FieldStorageConfigInterface The unsaved field storage definition.

Overrides MediaSourceBase::createSourceFieldStorage

1 call to AcquiadamAsset::createSourceFieldStorage()
AcquiadamAsset::submitConfigurationForm in src/Plugin/media/Source/AcquiadamAsset.php
Form submission handler.

File

src/Plugin/media/Source/AcquiadamAsset.php, line 150

Class

AcquiadamAsset
Provides media type plugin for Acquia DAM assets.

Namespace

Drupal\media_acquiadam\Plugin\media\Source

Code

protected function createSourceFieldStorage() {
  $default_field_name = $this
    ->defaultConfiguration()['source_field'];

  // Create the field.
  return $this->entityTypeManager
    ->getStorage('field_storage_config')
    ->create([
    'entity_type' => 'media',
    'field_name' => $default_field_name,
    'type' => reset($this->pluginDefinition['allowed_field_types']),
  ]);
}