Jump to content

Customise admin navigation to help identify current instance


operat
 Share

Recommended Posts

I wonder whether it is possible to customise the admin navigation in a way that makes it easier to distinguish one ProcessWire instance from another. What I have in mind, is a small image/icon somewhere in the top navigation bar, which visually identifies the current project (see attachment). That would help a lot! Is it possible?

pw_admin_idea_icon.jpg

Link to comment
Share on other sites

You should be able to hook into AdminTheme::getExtraMarkup and add your image to $extras["masthead"] (untested):

$wire->addHookAfter('AdminTheme::getExtraMarkup', function($event) {
  $extras = $event->return;
  $extras['masthead'] .= ' <img src="path/to/your/logo.png">';
  $event->return = $extras;
});

You can look into AdminThemeDefault/default.php to see where the different extras are used.

  • Like 1
Link to comment
Share on other sites

@BitPoet thanks for your quick reply!

The genaral approach works, which is great! However, this hook adds the <img> as the first element in the #masthead. What I would like to achieve is, adding something like <li><img src="path/to/your/logo.png"></li> as the last element in #topnav. What needs to be changed?

Link to comment
Share on other sites

Ah, didn't look which admin theme you're using. Hooking into AdminThemeRenoHelpers::topNavItems should be the way to go.

$wire->addHookAfter('AdminThemeRenoHelpers::topNavItems', function($event) {
  $out = $event->return;
  $out .= '<li><img src="path/to/your/logo.png"></li>';
  $event->return = $out;
});

 

  • Like 2
Link to comment
Share on other sites

Sorry, didn't mention I was using Reno. Now it works. Thank you very much!

I added styling for the image with the help of the Admin Custom Files module (http://modules.processwire.com/modules/admin-custom-files/). Is there another/better/recommended way to go?

  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...

I'm still unsure, so I'd like to ask again: I added styling for the image with the help of the Admin Custom Files module (http://modules.processwire.com/modules/admin-custom-files/). Is there another/better/recommended way to go?

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...