From 5d7fe43083ed6514758c088d755b6a515291e5f2 Mon Sep 17 00:00:00 2001 From: Lio Novelli Date: Wed, 17 Nov 2021 11:14:00 +0100 Subject: [PATCH] WV-4745: Add mudule_hander service trait. --- src/Core/Extension/ModuleHandlerTrait.php | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/Core/Extension/ModuleHandlerTrait.php diff --git a/src/Core/Extension/ModuleHandlerTrait.php b/src/Core/Extension/ModuleHandlerTrait.php new file mode 100644 index 0000000..b4007f7 --- /dev/null +++ b/src/Core/Extension/ModuleHandlerTrait.php @@ -0,0 +1,45 @@ +moduleHandler = $moduleHandler; + return $this; + } + + /** + * Gets the module handler. + * + * @return \Drupal\Core\Extension\ModuleHandlerInterface + * The module handler. + */ + public function getModuleHandler() { + if (empty($this->moduleHandler)) { + $this->moduleHandler = \Drupal::service('module_handler'); + } + return $this->moduleHandler; + } + +}