protected function filterExtensionsByModule($modules, $module)
    {
        if ($this->isMetadataVersionGreaterEqual($module, '2.0')) {
            $moduleHelper = Registry::get(ModuleHelper::class);
            $moduleHelper->setModule($module);
            $path = $moduleHelper->getModuleNameSpace();
        } else {

            $modulePaths = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aModulePaths');

            $moduleId = $module->getId();
            $path = '';
            if (isset($modulePaths[$moduleId])) {
                $path = $modulePaths[$moduleId] . '/';
            }

            if (!$path) {
                $path = $moduleId . "/";
            }
        }
        $filteredModules = [];

        if (!$path) {
            return $filteredModules;
        }

       foreach ($modules as $class => $extend) {
            foreach ($extend as $extendPath) {
                if (strpos($extendPath, $path) === 0) {
                    $filteredModules[$class][] = $extendPath;
                }
            }
        }

        return $filteredModules;
    }