Jump to content

Add item to user navigation menu


webhoes
 Share

Recommended Posts

Hello,

 I want to add an item to the user navigation menu. In the picture below I added it (My studbooks) in the core files. It is hookable, but I can't get the hook to work.

image.thumb.png.f2ea75e5c419a6a82b6045bd0a49c477.png

 

Ready.php

// /* to figure out */
$this->addHookAfter('AdminThemeFramework::getUserNavArray', function(HookEvent $event) {
// Get the object the event occurred on, if needed
$AdminThemeFramework = $event->object;
 
$AdminThemeFramework = $navArray();
 
// An 'after' hook can retrieve and/or modify the return value
$return = $event->return;
 
/* Your code here, perhaps modifying the return value */
$navArray[] = array(
'url' => '/my-studbooks/',
'title' => $this->_('My studbooks'),
'target' => '_top',
'icon' => 'eye',
);
 
// Populate back return value, if you have modified it
$event->return = $return;
});

What should I change to get it working from ready.php

 

Link to comment
Share on other sites

Hi @webhoes 

Try the following corrected hook :

 

// /* to figure out */
$this->addHookAfter('AdminThemeFramework::getUserNavArray', function(HookEvent $event) {
    // Get the object the event occurred on, if needed
    $AdminThemeFramework = $event->object;
     
    // An 'after' hook can retrieve and/or modify the return value
    $return = $event->return;
    
    /* Your code here, perhaps modifying the return value */
    $navArray[] = array(
    'url' => '/My studbooks/',
    'title' => $this->_('My studbooks'),
    'target' => '_top',
    'icon' => 'eye',
    );

    // merge the return value with your own nav array
    $return = array_merge($return, $navArray);
     
    // Populate back return value, if you have modified it
    $event->return = $return;
});

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...