Question : drupal 8 get module path
Answered by : gleaming-gannet-htlwomz3dthc
// Module path
$module_handler = \Drupal::service('module_handler');
$module_path = $module_handler->getModule('my_module')->getPath();
Source : | Last Update : Thu, 24 Sep 20
Question : drupal get module path
Answered by : gleaming-gannet-htlwomz3dthc
$module_handler = \Drupal::service('module_handler');
$module_path = $module_handler->getModule('my_module')->getPath();
#Alternative
$module_path = \Drupal::service('extension.list.module')->getPath('MODULE_NAME');
Source : | Last Update : Mon, 18 Jul 22
Question : Drupal 8 get a module path
Answered by : mahmoud-sayed-f90wzyg07qfb
$build['#attached']['drupalSettings']['mymodule']['mylib']['path'] = \Drupal::service('extension.list.module')->getPath('mymodule');
Source : https://drupal.stackexchange.com/questions/201388/how-do-i-get-a-module-path | Last Update : Sun, 04 Dec 22