You are here

public function Bynder::createMetadataField in Bynder 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/media/Source/Bynder.php \Drupal\bynder\Plugin\media\Source\Bynder::createMetadataField()
  2. 4.0.x src/Plugin/media/Source/Bynder.php \Drupal\bynder\Plugin\media\Source\Bynder::createMetadataField()

Creates the metadata field definition.

Parameters

\Drupal\media\MediaTypeInterface $type: The media type.

Return value

\Drupal\field\FieldConfigInterface The unsaved field definition. The field storage definition, if new, should also be unsaved.

File

src/Plugin/media/Source/Bynder.php, line 453

Class

Bynder
Provides media source plugin for Bynder.

Namespace

Drupal\bynder\Plugin\media\Source

Code

public function createMetadataField(MediaTypeInterface $type) {
  return $this->entityTypeManager
    ->getStorage('field_config')
    ->create([
    'entity_type' => 'media',
    'field_name' => BynderMetadataItem::METADATA_FIELD_NAME,
    'bundle' => $type
      ->id(),
    'label' => 'Bynder Metadata',
    'translatable' => FALSE,
    'field_type' => 'bynder_metadata',
  ]);
}