function CategorizingPluginManagerTrait::getModuleHandler

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getModuleHandler()
  2. 10 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getModuleHandler()
  3. 11.x core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getModuleHandler()

Returns the module handler used.

Return value

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

File

core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php, line 64

Class

CategorizingPluginManagerTrait
Provides a trait for the CategorizingPluginManagerInterface.

Namespace

Drupal\Core\Plugin

Code

public function getModuleHandler() {
    // If the class has an injected module handler, use it. Otherwise fall back
    // to fetch it from the service container.
    if (isset($this->moduleHandler)) {
        return $this->moduleHandler;
    }
    return \Drupal::moduleHandler();
}

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