porl Posted February 1, 2020 Share Posted February 1, 2020 Hi all. I've made a small tweak to the ProcessPageList core module. I like the page actions hover feature but find it a bit fiddly hovering over the page labels. I made a change to (optionally, toggleable in settings) show the actions when hovering over the entire page row. I mostly did this for myself but is there any interest in people using this? I'm not sure it is worth releasing as a full module, as it then would require tracking updates etc. and is just a small change in a couple of files. If there is interest though I guess I could request a pull request (if @ryan doesn't want to just use the diff file below). ProcessPageList.diff 1 Link to comment Share on other sites More sharing options...
tpr Posted February 1, 2020 Share Posted February 1, 2020 Isn't AdminOnSteroids pagelist tweaks suit your needs? https://github.com/rolandtoth/AdminOnSteroids/wiki/PageListTweaks Show pagelist actions on full row hover: makes pagelist actions visible on hovering anywhere in the pagelist, not only on the page title 4 Link to comment Share on other sites More sharing options...
horst Posted February 1, 2020 Share Posted February 1, 2020 ... and, if you want to do something that AOS doesn't support, one should use HOOKS instead of rewriting core modules, to avoid the version update hassle. ? TLDR; Following some example code from 2014/2015, (written before AOS was released). Spoiler class jhpArchiveHelper extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'JHP Archive Helper', 'version' => 200, 'summary' => "ImageImports with IPTC | add Pagelist Labelitems | provides ICON-markup | and more ...", 'href' => '', 'author' => 'horst', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookBefore('InputfieldFile::fileAdded', $this, 'importImage'); $this->addHookBefore('ProcessPageView::pageNotFound', $this, 'hookLog404Errors'); $this->addHookAfter('Pages::save', $this, 'hookAfterPagesSave'); $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageListLabelItems'); /* <=== */ $this->addHook('LazyCron::every30Minutes', $this, 'cacheModifiedStamps'); if(wire('user')->isLoggedIn) { // we need to check more frequently to recognize changes in the lists $this->addHook('LazyCron::everyMinute', $this, 'cacheModifiedStamps'); } } public function addPageListLabelItems($event) { $page = $event->arguments('page'); if('album' == $page->template) { $archivnummer = $page->archivnummer == '' ? ' <span class="jhpPageListItemEmpty archivnummer">------</span> ' : ' <span class="jhpPageListItem archivnummer">' . $page->archivnummer . '</span> '; $event->return = $archivnummer . $event->return . ' <span class="jhpPageListImageCount">' . count($page->images) . '</span> '; return; } if('tools' == $page->template && 'albums-thumbs-colspan' == $page->parent->name) { $added = ' <span class="jhpPageListItem archivnummer">' . $page->name . '</span> '; $event->return = $added . $event->return; return; } if('architekt' == $page->template) { $architektenort = $page->ortarchitekt == '' ? ' <span class="jhpPageListItemEmpty"><strong style="color:white">kein Ort eingetragen</strong></span> ' : ''; $event->return = $event->return . $architektenort; return; } } ... 2 Link to comment Share on other sites More sharing options...
porl Posted February 1, 2020 Author Share Posted February 1, 2020 Well then... I guess I can delete my module haha Nice one, I'd heard of AOS but didn't think to check it for this feature. As I said, I was just playing with it for my own sake and thought that since it was a small change it might be able to be included. Didn't think to use hooks (and to be honest I'm not sure I would have known which ones to use and how to do it in this case). Thanks for the input, happy to learn! 4 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