public function factory($module, $action)
    {
        if (empty($module) || empty($action)) {
            return;
        }

        try {
            if (!$this->pluginManager->isPluginActivated($module)) {
                return;
            }

            $plugin = $this->pluginManager->getLoadedPlugin($module);
        } catch (\Exception $e) {
            // we are not allowed to use possible widgets, plugin is not active
            return;
        }

        /** @var Widget[] $widgetContainer */
        $widgets = $plugin->findMultipleComponents('Widgets', 'Piwik\\Widget\\Widget');

        foreach ($widgets as $widgetClass) {
            $config = $this->getWidgetConfigForClassName($widgetClass);
            if ($config->getAction() === $action) {
                $config->checkIsEnabled();
                return StaticContainer::get($widgetClass);
            }
        }
    }
public function factory($module, $action)
    {
        if (empty($module) || empty($action)) {
            return;
        }

        try {
            if (!$this->pluginManager->isPluginActivated($module)) {
                return;
            }

            $plugin = $this->pluginManager->getLoadedPlugin($module);
        } catch (\Exception $e) {
            // we are not allowed to use possible widgets, plugin is not active
            return;
        }

        /** @var Widget[] $widgetContainer */
        $widgets = $plugin->findMultipleComponents('Widgets', 'Piwik\\Widget\\Widget');

        foreach ($widgets as $widgetClass) {
            $config = $this->getWidgetConfigForClassName($widgetClass);
            if ($config->getAction() === $action) {
                $config->checkIsEnabled();
                return StaticContainer::get($widgetClass);
            }
        }
    }
public function factory ( $ module , $ action ) { if ( empty ( $ module ) || empty ( $ action ) ) { return ; } try { if ( ! $ this -> pluginManager -> isPluginActivated ( $ module ) ) { return ; } $ plugin = $ this -> pluginManager -> getLoadedPlugin ( $ module ) ; } catch ( \ Exception $ e ) { // we are not allowed to use possible widgets, plugin is not active return ; } /** @var Widget[] $widgetContainer */ $ widgets = $ plugin -> findMultipleComponents ( 'Widgets' , 'Piwik\\Widget\\Widget' ) ; foreach ( $ widgets as $ widgetClass ) { $ config = $ this -> getWidgetConfigForClassName ( $ widgetClass ) ; if ( $ config -> getAction ( ) === $ action ) { $ config -> checkIsEnabled ( ) ; return StaticContainer :: get ( $ widgetClass ) ; } } }
Get the widget defined by the given module and action.

@param string $module Aka plugin name, eg 'CoreHome'
@param string $action An action eg 'renderMe'
@return Widget|null
@throws \Exception Throws an exception if the widget is not enabled.
Get the widget defined by the given module and action .