You are here

class DefaultMediaSelectionProcessor in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 src/MediaSelectionProcessor/DefaultMediaSelectionProcessor.php \Drupal\gutenberg\MediaSelectionProcessor\DefaultMediaSelectionProcessor

Handles default processing for media library selection.

@package Drupal\gutenberg\MediaSelectionProcessor

Hierarchy

Expanded class hierarchy of DefaultMediaSelectionProcessor

1 string reference to 'DefaultMediaSelectionProcessor'
gutenberg.services.yml in ./gutenberg.services.yml
gutenberg.services.yml
1 service uses DefaultMediaSelectionProcessor
gutenberg.media_selection_processor.default in ./gutenberg.services.yml
Drupal\gutenberg\MediaSelectionProcessor\DefaultMediaSelectionProcessor

File

src/MediaSelectionProcessor/DefaultMediaSelectionProcessor.php, line 12

Namespace

Drupal\gutenberg\MediaSelectionProcessor
View source
class DefaultMediaSelectionProcessor implements MediaSelectionProcessorInterface {

  /**
   * Entity type manager instance.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * DefaultMediaSelectionProcessor constructor.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   */
  public function __construct(EntityTypeManagerInterface $entity_type_manager) {
    $this->entityTypeManager = $entity_type_manager;
  }

  /**
   * {@inheritDoc}
   */
  public function process(array $data) {
    return $this->entityTypeManager
      ->getStorage('media')
      ->loadMultiple($data);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DefaultMediaSelectionProcessor::$entityTypeManager protected property Entity type manager instance.
DefaultMediaSelectionProcessor::process public function Process data and get array of created media entities. Overrides MediaSelectionProcessorInterface::process
DefaultMediaSelectionProcessor::__construct public function DefaultMediaSelectionProcessor constructor.