You are here

public function MediaSelectionProcessorManager::registerProcessor in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 src/MediaSelectionProcessor/MediaSelectionProcessorManager.php \Drupal\gutenberg\MediaSelectionProcessor\MediaSelectionProcessorManager::registerProcessor()

Register media selection processor.

Parameters

\Drupal\gutenberg\MediaSelectionProcessor\MediaSelectionProcessorInterface $processor: Media selection processor instance.

\Drupal\gutenberg\MediaSelectionProcessor\string $processor_name: Processor name.

Overrides MediaSelectionProcessorManagerInterface::registerProcessor

File

src/MediaSelectionProcessor/MediaSelectionProcessorManager.php, line 22

Class

MediaSelectionProcessorManager
Provides management for tagged media selection processor services.

Namespace

Drupal\gutenberg\MediaSelectionProcessor

Code

public function registerProcessor(MediaSelectionProcessorInterface $processor, string $processor_name) {
  if ($this
    ->isRegistered($processor_name)) {
    throw new \Exception(sprintf("Processor '%s' has been already registered", $processor_name));
  }
  $this->processors[$processor_name] = $processor;
}