Commit c19be9ca authored by Vishal Khode's avatar Vishal Khode
Browse files

Issue #3315088: Added fix to support back Drupal 8.

parent e47a130d
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -3,19 +3,20 @@
namespace Drupal\component;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderInterface;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Symfony\Component\DependencyInjection\Reference;

class ComponentServiceProvider implements ServiceProviderInterface {
class ComponentServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container) {
  public function alter(ContainerBuilder $container) {
    // @todo Delete this when dropping Drupal 8 support.
    if ($container->has('component.discovery') && version_compare(\Drupal::VERSION, '9.0', '<')) {
      // @see https://www.drupal.org/project/drupal/issues/3074585
      $container->getDefinition('component.discovery')
        ->setArgument(0, '@app.root');
        ->setArgument(0, new Reference('app.root'));
    }
  }