Cybermano Posted April 1, 2021 Share Posted April 1, 2021 Many thanks Bernhard, for your reply and your time. I’ll surely look at this and try. Then I will update you. Thanks again. 1 Link to comment Share on other sites More sharing options...
Cybermano Posted April 2, 2021 Share Posted April 2, 2021 Hello. I confirm you that I was able to implement the panel view. Thank you so much. I owe you a truck of beers! ? I dare, for those who may then use the same snippet you posted, that the url of the link must be between the quotes (and in my case I also had to remove #pw-masthead, not having a specific id). $(document).ready(function() { pwPanels.addPanel($("a[href='/your/admin/link/url']")); }); I also thank @Soma for publishing this tutorial, otherwise I would sail in the deepest dark ...;) All you are my hero! ? P.S. My next target is to hook my restaurant menu repeater to create a button with the same link, (so editors could obtain the list in place, without scrolling to top). If all will go right, I will share the code of the hook, the button and the List of Allergens (Hanna Code). Of course I will use your suggestion for the button... ? admin-pw-panel.mp4 Link to comment Share on other sites More sharing options...
bernhard Posted April 2, 2021 Author Share Posted April 2, 2021 15 minutes ago, Cybermano said: I owe you a truck of beers! ? Well, feel free to do so - I'll happily drink them with my friends once the pandemic is over ? http://paypal.me/baumrock Hooking the page edit form is a lot easier: $wire->addHookAfter("ProcessPageEdit::buildForm", function($event) { $form = $event->return; $page = $event->process->getPage(); if($page->template != 'yourtemplate') return; if($f = $form->get('yourfield')) { $f->notes = "Show allergens <a href='/link/to/allergens' class='pw-panel'>here</a>"; $f->entityEncodeText = false; } }); 1 Link to comment Share on other sites More sharing options...
Cybermano Posted April 2, 2021 Share Posted April 2, 2021 4 hours ago, bernhard said: Hooking the page edit form is a lot easier ... Thanks again. I already wrote only few hooks by myself, but a pro tip is always welcome. ? Link to comment Share on other sites More sharing options...
Cybermano Posted April 9, 2021 Share Posted April 9, 2021 As promised: I've posted here my little contribution. For who could be interested. ? Link to comment Share on other sites More sharing options...
bernhard Posted July 28, 2021 Author Share Posted July 28, 2021 Update: Here's a little snippet how to use dynamic navigation items using the NavJSON feature: // in getModuleInfo() 'useNavJSON' => true, // enable JSON nav feature 'nav' => [ [ 'url' => 'contacts', 'label' => 'Contacts', 'icon' => 'users', ],[ 'url' => 'mailings', 'label' => 'Mailings', 'icon' => 'folder-open-o', 'navJSON' => 'mailings-nav', // this will call executeMailingsNav() to get items ],[ 'url' => 'groups', 'label' => 'Groups', 'icon' => 'users', ], ] // and in the module /** * JSON nav for mailings */ public function executeMailingsNav() { $options['add'] = null; // no link to add pages $options['edit'] = $this->mailer()->url."new/?channel={name}"; $options['itemLabel'] = 'label'; // use the label property as item label (default is name) $options['items'] = []; foreach($this->mailer()->channels as $channel) { $data = $this->wire(new WireData()); /** @var WireData $data */ $data->name = $channel->short; $data->label = "New ".$channel->name; $data->icon = "plus-circle"; $options['items'][] = $data; } return parent::___executeNavJSON($options); } 8 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now