Created
September 24, 2016 22:39
-
-
Save shakhmehedi/b8c908f226bf9e6271976a80c8436f3b to your computer and use it in GitHub Desktop.
Magento 2: How to get a module filesystem path programmatically From https://mage2.pro/t/topic/57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param string $moduleName | |
* @param string $type [optional] | |
* @return string | |
* @throws \InvalidArgumentException | |
*/ | |
function df_module_dir($moduleName, $type = '') { | |
/** @var \Magento\Framework\ObjectManagerInterface $om */ | |
$om = \Magento\Framework\App\ObjectManager::getInstance(); | |
/** @var \Magento\Framework\Module\Dir\Reader $reader */ | |
$reader = $om->get('Magento\Framework\Module\Dir\Reader'); | |
return $reader->getModuleDir($type, $moduleName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment