You are here

public function CategorizingPluginManagerTrait::getModuleHandler in Drupal 8

Same name and namespace in other branches
  1. 9 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()

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();
}