Skip to content

Instantly share code, notes, and snippets.

@jules0x
Last active August 29, 2015 14:26
Show Gist options
  • Save jules0x/4fb4c0729e4c90cd0a06 to your computer and use it in GitHub Desktop.
Save jules0x/4fb4c0729e4c90cd0a06 to your computer and use it in GitHub Desktop.
An example of a custom CMS menu-item created using a DataExtension
LeftAndMain:
extensions:
- CustomMenuItemExtension
<?php
class CustomMenuItemExtension extends LeftAndMainExtension {
public function init() {
// unique identifier for this item. Will have an ID of Menu-$ID
$id = 'LinkToGoogle';
// your 'nice' title
$title = 'Google';
// the link you want to item to go to
$link = 'http://google.com';
// priority controls the ordering of the link in the CMS menu
$priority = -3;
// Add your own attributes onto the link
$attributes = array(
'target' => '_blank'
);
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