You are here

class MenuLinkWeightServiceProvider in Menu Link Weight 8

Same name and namespace in other branches
  1. 8.2 src/MenuLinkWeightServiceProvider.php \Drupal\menu_link_weight\MenuLinkWeightServiceProvider

Overrides the menu.parent_form_selector service.

Hierarchy

Expanded class hierarchy of MenuLinkWeightServiceProvider

File

src/MenuLinkWeightServiceProvider.php, line 13

Namespace

Drupal\menu_link_weight
View source
class MenuLinkWeightServiceProvider extends ServiceProviderBase {

  /**
   * @inheritDoc
   */
  public function alter(ContainerBuilder $container) {
    $settings = BootstrapConfigStorageFactory::get()
      ->read('menu_link_weight.settings');
    $modules = $container
      ->getParameter('container.modules');
    if (isset($settings['menu_parent_form_selector']) && $settings['menu_parent_form_selector'] === 'cshs' && isset($modules['cshs'])) {
      $defintion = $container
        ->getDefinition('menu.parent_form_selector');
      $defintion
        ->setClass(CshsMenuParentFormSelector::class);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MenuLinkWeightServiceProvider::alter public function @inheritDoc Overrides ServiceProviderBase::alter
ServiceProviderBase::register public function Registers services to the container. Overrides ServiceProviderInterface::register 1