function CategorizingPluginManagerTrait::getModuleHandler

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getModuleHandler()
  2. 8.9.x core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getModuleHandler()
  3. 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.

Deprecated

in drupal:10.3.0 and is removed from drupal:12.0.0. There is no replacement.

See also

https://www.drupal.org/node/3310017

File

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

Class

CategorizingPluginManagerTrait
Provides a trait for the CategorizingPluginManagerInterface.

Namespace

Drupal\Core\Plugin

Code

public function getModuleHandler() {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3310017', E_USER_DEPRECATED);
    // 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.