Piwik\Widget\WidgetsList::remove PHP Метод

remove() публичный Метод

Removes one or more widgets from the widget list.
public remove ( string $widgetCategoryId, string | false $widgetName = false )
$widgetCategoryId string The widget category id. Can be a translation token eg 'General_Visits' see {@link WidgetConfig::setCategoryId()}.
$widgetName string | false The name of the widget to remove eg 'VisitTime_ByServerTimeWidgetName'. If not supplied, all widgets within that category will be removed.
    public function remove($widgetCategoryId, $widgetName = false)
    {
        foreach ($this->widgets as $index => $widget) {
            if ($widget->getCategoryId() === $widgetCategoryId) {
                if (!$widgetName || $widget->getName() === $widgetName) {
                    unset($this->widgets[$index]);
                }
            }
        }
    }