setCategoryId('About Matomo'); /** * Set the subcategory the widget belongs to. If a subcategory is set, the widget will be shown in the UI. */ // $config->setSubcategoryId('General_Overview'); /** * Set the name of the widget belongs to. */ $config->setName('Example Widget Name'); /** * Set the order of the widget. The lower the number, the earlier the widget will be listed within a category. */ $config->setOrder(99); /** * Optionally set URL parameters that will be used when this widget is requested. * $config->setParameters(array('myparam' => 'myvalue')); */ /** * Define whether a widget is enabled or not. For instance some widgets might not be available to every user or * might depend on a setting (such as Ecommerce) of a site. In such a case you can perform any checks and then * set `true` or `false`. If your widget is only available to users having super user access you can do the * following: * * $config->setIsEnabled(\Piwik\Piwik::hasUserSuperUserAccess()); * or * if (!\Piwik\Piwik::hasUserSuperUserAccess()) * $config->disable(); */ } /** * This method renders the widget. It's on you how to generate the content of the widget. * As long as you return a string everything is fine. You can use for instance a "Piwik\View" to render a * twig template. In such a case don't forget to create a twig template (eg. myViewTemplate.twig) in the * "templates" directory of your plugin. * * @return string */ public function render() { // or: return $this->renderTemplate('myViewTemplate', array(...view variables...)); return '
My Widget Text
'; } }