Skip to content

Instantly share code, notes, and snippets.

@mooror
Created January 7, 2019 22:19
Show Gist options
  • Save mooror/1ebb85b79ef095ed8d1d3d68be6ed4b4 to your computer and use it in GitHub Desktop.
Save mooror/1ebb85b79ef095ed8d1d3d68be6ed4b4 to your computer and use it in GitHub Desktop.
Trying to add a custom link to the CMS menu in SS4
---
Name: paypalautosellerconfig
---
SilverStripe\Admin\LeftAndMain:
extensions:
- Sitelease\PaypalAutoSeller\Extensions\ProductWorkflowCMSMenuExtension
<?php
namespace Sitelease\PaypalAutoSeller\Extensions;
use SilverStripe\Admin\CMSMenu;
use SilverStripe\Admin\LeftAndMainExtension;
class ProductWorkflowCMSMenuExtension extends LeftAndMainExtension
{
public function init()
{
// unique identifier for this item. Will have an ID of Menu-$ID
$id = 'ProductWorkflow';
// your 'nice' title
$title = 'Product Workflow';
// the link you want to item to go to
$link = 'http://upsales.devserver.localdomain/admin/email-offer-tracking/Sitelease-PaypalAutoSeller-Model-Offer/EditForm/field/Sitelease-PaypalAutoSeller-Model-Offer/item/new';
// priority controls the ordering of the link in the stack. The
// lower the number, the lower in the list
$priority = 3;
// Add your own attributes onto the link. In our case, we want to
// open the link in a new window (not the original)
$attributes = [
'title' => 'Open the product creation workflow'
];
CMSMenu::add_link($id, $title, $link, $priority, $attributes);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment