commerce_product_bundles-8.x-1.0/src/ProductBundlesServiceProvider.php

src/ProductBundlesServiceProvider.php
<?php

namespace Drupal\commerce_product_bundles;

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

/**
 * Class ProductBundlesServiceProvider
 *
 * Code was taken from and modified:
 * @see \Drupal\commerce_product\CommerceProductServiceProvider
 *
 * @package Drupal\commerce_product
 */
class ProductBundlesServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    // Get list of modules.
    $modules = $container->getParameter('container.modules');

    // Check if there is layout builder and swap field renderer service.
    if (isset($modules['layout_builder'])) {
      $definition = $container->getDefinition('commerce_product_bundles.bundle_variation_field_renderer');
      $definition->setClass(BundleVariationFieldRendererLayoutBuilder::class)
        ->addArgument(new Reference('entity_display.repository'));
    }
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc