You are here

public function AutomatedCropProvider::addProvider in Automated Crop 8

Register automated crop plugins as crop api providers.

Parameters

\Drupal\crop\Events\AutomaticCropProviders $event: The Event to process.

File

modules/automated_crop_crop_provider/src/EventSubscriber/AutomatedCropProvider.php, line 20

Class

AutomatedCropProvider
Subscribe each automated crop providers as automatic crop api provider.

Namespace

Drupal\automated_crop_crop_provider\EventSubscriber

Code

public function addProvider(AutomaticCropProviders $event) {
  foreach (\Drupal::service('plugin.manager.automated_crop')
    ->getProviderOptionsList() as $key => $provider) {
    $event
      ->registerProvider([
      $key => $provider
        ->render(),
    ]);
  }
}