bernhard Posted April 28, 2021 Share Posted April 28, 2021 I'm using PageHitCounter module by @David Karich The problem is that the page hit labels show up in my pagelistselect and when I select a page, the label of that page is "123 My Page" instead of "My Page" (where 123 is the page hit count). PHC attaches a hook to getPageLabel so I wonder if there is a way to determine if the render happens inside a pagelistselect field or not. $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageListHitCounter'); Doing it via CSS does not work unfortunately, because I can hide the hit counter in the page tree, but selecting the page will show the count nevertheless because it is using js text() which does not take the display:none into account I guess. Any ideas? Link to comment Share on other sites More sharing options...
Zeka Posted April 28, 2021 Share Posted April 28, 2021 if($this->showForBackend) { $this->addHookBefore('ProcessPageList::execute', function ($event) { wire('config')->styles->add($this->config->urls->PageHitCounter . 'PageHitCounter.min.css'); if($this->wire('input')->get('mode') != 'select') { $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageListHitCounter'); } }); } 2 Link to comment Share on other sites More sharing options...
bernhard Posted April 29, 2021 Author Share Posted April 29, 2021 Genius ?? Thank you!! I've created a PR @David Karich https://github.com/FlipZoomMedia/PageHitCounter/pull/9 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