| Server IP : 167.99.224.18 / Your IP : 216.73.216.136 Web Server : Apache/2.4.41 (Ubuntu) System : Linux wordpress-ubuntu-s-1vcpu-1gb-nyc1-01 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.0.25 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins-old/matomo/app/core/Widget/ |
Upload File : |
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Widget;
/**
* Defines a new widget container. Widget containers are useful when you want to combine several widgets
* into one unique widgets. For example you could combine an evolution graph widget with a sparklines widget
* and combine them to a single "overview widget". It also allows you to specify layouts meaning you can
* define a layout that will group multiple widgets into one widget displaying a menu on the left side for each
* widget and the actual widget on the right side. By default widgets within a container are displayed vertically
* one after another.
*
* To define a widget container just place a subclass within the `Widgets` folder of your plugin.
*
* @api since Piwik 3.0.0
*/
class WidgetContainerConfig extends \Piwik\Widget\WidgetConfig
{
/**
* @var WidgetConfig[]
*/
protected $widgets = array();
protected $layout = '';
protected $id = '';
protected $module = 'CoreHome';
protected $action = 'renderWidgetContainer';
protected $isWidgetizable = \false;
/**
* Sets (overwrites) the id of the widget container.
*
* The id can be used by any plugins to add more widgets to this container and it will be also used for the unique
* widget id and in the URL to render this widget.
*
* @param string $id eg 'Products' or 'Contents'
* @return static
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Get the id of the widget.
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Sets the layout of the container widget.
*
* By default widgets within a container are displayed one after another. In case you want to change this
* behaviour you can specify a layout that will be recognized by the UI. It is not yet possible to define
* custom layouts.
*
* @param string $layout eg 'ByDimension' see {@link Piwik\Plugins\CoreHome\CoreHome::WIDGET_CONTAINER_LAYOUT_BY_DIMENSION}
* @return static
*/
public function setLayout($layout)
{
$this->layout = $layout;
return $this;
}
/**
* Gets the currently set layout.
* @return string
*/
public function getLayout()
{
return $this->layout;
}
/**
* Adds a new widget to the container widget.
*
* @param WidgetConfig $widget
* @return static
*/
public function addWidgetConfig(\Piwik\Widget\WidgetConfig $widget)
{
$this->widgets[] = $widget;
return $this;
}
/**
* Set (overwrite) widget configs.
*
* @param WidgetConfig[] $configs
*/
public function setWidgetConfigs($configs)
{
$this->widgets = $configs;
}
/**
* Get all added widget configs.
*
* @return WidgetConfig[]
*/
public function getWidgetConfigs()
{
return $this->widgets;
}
/**
* @inheritdoc
*/
public function getUniqueId()
{
$parameters = $this->getParameters();
unset($parameters['module']);
unset($parameters['action']);
unset($parameters['containerId']);
return \Piwik\Widget\WidgetsList::getWidgetUniqueId($this->id, '', $parameters);
}
/**
* @inheritdoc
*/
public function getParameters()
{
$params = parent::getParameters();
$params['containerId'] = $this->getId();
return $params;
}
}