function FilteredPluginManagerTrait::moduleHandler

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/FilteredPluginManagerTrait.php \Drupal\Core\Plugin\FilteredPluginManagerTrait::moduleHandler()
  2. 10 core/lib/Drupal/Core/Plugin/FilteredPluginManagerTrait.php \Drupal\Core\Plugin\FilteredPluginManagerTrait::moduleHandler()
  3. 11.x core/lib/Drupal/Core/Plugin/FilteredPluginManagerTrait.php \Drupal\Core\Plugin\FilteredPluginManagerTrait::moduleHandler()

Wraps the module handler.

Return value

\Drupal\Core\Extension\ModuleHandlerInterface The module handler.

1 method overrides FilteredPluginManagerTrait::moduleHandler()
TestFilteredPluginManager::moduleHandler in core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php
Wraps the module handler.

File

core/lib/Drupal/Core/Plugin/FilteredPluginManagerTrait.php, line 53

Class

FilteredPluginManagerTrait
Provides a trait for plugin managers that allow filtering plugin definitions.

Namespace

Drupal\Core\Plugin

Code

protected function moduleHandler() {
    if (property_exists($this, 'moduleHandler') && $this->moduleHandler instanceof ModuleHandlerInterface) {
        return $this->moduleHandler;
    }
    return \Drupal::service('module_handler');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.