Quantcast
Viewing all articles
Browse latest Browse all 13974

Setting plugin / widget menu order

@pace wrote:

Hello!

I’m trying to add my plugin/widget to the left menu at a specific position under ‘Actions’ that is already occupied by a default plugin. I cannot make my plugin appear “higher up”, interspersed with the default activated plugins (only afterward, or in a separate category).

In the documentation for plugin/widget development, I see the following code sets the initial menu order:
$this->order = X;

For instance, the plugin ‘Pages’ has $this->order = 2; (from Plugins\Actions\Reports\GetPageUrls.php) and ‘Entry Pages’ has an order = 3 (from GetEntryPageUrls.php). This corresponds nicely to the order I see, so it makes sense.

A couple questions:

  1. If I put a “conflicting” order for my plugin (i.e. I also set $order=2), what happens? Should it insert where I want it to and push down the following plugins? Because it does not.

  2. If I change the order manually for the default plugins (e.g. setting $this->order = 99 in GetEntryPageUrls.php), why does the default plugin not change order (moving away from the third position in this specific example)?

  3. What is the difference in setting these initial orders in the definition of the Report (along with a $categoryId and $subcategoryId) versus managing the menu order via WidgetConfigs e.g.

public static function configure(WidgetConfig $config)
    {
        $config->setCategoryId('About Piwik');
        $config->setName('My Example Widget');
        $config->setOrder(5);
    }

Thanks in advance for the pointers!


Piwik version: 3.2.1
MySQL version: 5.7.20
PHP version: 7.2.0RC2

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 13974

Trending Articles