Skip to content
Snippets Groups Projects
Select Git revision
  • project-update-bot-only
  • 8.x-1.x default
  • 3433816-automated-drupal-11
  • 3433816-manual-drupal-11
  • 7.x-1.x
  • previous/3433816-automated-drupal-11/2024-07-28
  • previous/project-update-bot-only/2024-06-18
  • previous/project-update-bot-only/2024-06-08
  • previous/project-update-bot-only/2024-06-02
  • previous/project-update-bot-only/2024-05-30
  • 8.x-1.17
  • 8.x-1.16
  • 8.x-1.15
  • 8.x-1.14
  • 8.x-1.13
  • 8.x-1.12
  • 8.x-1.11
  • 8.x-1.10
  • 8.x-1.9
  • 8.x-1.8
  • 8.x-1.7
  • 8.x-1.6
  • 8.x-1.5
  • 8.x-1.4
  • 8.x-1.3
25 results

ParagraphsServiceProvider.php

Blame
  • GoZ's avatar
    Issue #3165793 by GoZ: Uncaught ReflectionException error on dev if migrate module is not enabled
    Fabien Clément authored and Berdir committed
    80e4c5bf
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ParagraphsServiceProvider.php 1.43 KiB
    <?php
    
    namespace Drupal\paragraphs;
    
    use Drupal\Core\DependencyInjection\ContainerBuilder;
    use Drupal\Core\DependencyInjection\ServiceProviderBase;
    use Symfony\Component\DependencyInjection\Definition;
    use Symfony\Component\DependencyInjection\Reference;
    
    /**
     * Service Provider for Paragraphs.
     */
    class ParagraphsServiceProvider extends ServiceProviderBase {
    
      /**
       * {@inheritdoc}
       */
      public function register(ContainerBuilder $container) {
        $modules = $container->getParameter('container.modules');
        // Check for installed Replicate module.
        if (isset($modules['replicate']) ) {
          // Add a Replicate field event subscriber.
          $service_definition = new Definition(
            'Drupal\paragraphs\EventSubscriber\ReplicateFieldSubscriber',
            [new Reference('replicate.replicator')]
          );
          $service_definition->addTag('event_subscriber');
          $service_definition->setPublic(TRUE);
          $container->setDefinition('replicate.event_subscriber.paragraphs', $service_definition);
        }
        // Check for installed Migrate module.
        if (isset($modules['migrate']) ) {
          // Add a Migration plugins alterer service.
          $service_definition = new Definition('Drupal\paragraphs\MigrationPluginsAlterer');
          $service_definition->addArgument(new Reference('logger.factory'));
          $service_definition->setPublic(TRUE);
          $container->setDefinition('paragraphs.migration_plugins_alterer', $service_definition);
        }
      }
    }