Piwik\Plugin\Menu::urlForModuleAction PHP Method

urlForModuleAction() protected method

Generates a URL for the given action of the given module. We usually do not recommend to use this method as you should make sure the method of that module actually exists. If the plugin owner of that module changes the method in a future version your link might no longer work. If you want to link to an action of your controller use the method {@link urlForAction()}. Note: We will generate a link only if the given module is installed and activated.
Since: 2.7.0 // not API for now
protected urlForModuleAction ( string $module, string $controllerAction, array $additionalParams = [] ) : array | null
$module string The name of the module/plugin the action belongs to. The module name is case sensitive.
$controllerAction string The name of the action that should be executed within your controller
$additionalParams array Optional URL parameters that will be appended to the URL
return array | null Returns null if the given module is either not installed or not activated. Returns the array of query parameter names and values to the given module action otherwise.
    protected function urlForModuleAction($module, $controllerAction, $additionalParams = array())
    {
        $this->checkisValidCallable($module, $controllerAction);
        $pluginManager = PluginManager::getInstance();
        if (!$pluginManager->isPluginLoaded($module) || !$pluginManager->isPluginActivated($module)) {
            return null;
        }
        $params = (array) $additionalParams;
        $params['action'] = $controllerAction;
        $params['module'] = $module;
        return $params;
    }