nghi Posted February 19, 2014 Posted February 19, 2014 I was wondering how would I display an icon next to a template from the backend base on a field value? E.G date <= today Is it possible to just do it under the advance option? List of fields to display in the admin Page List
kongondo Posted February 19, 2014 Posted February 19, 2014 (edited) You know you can now (PW 2.4) use font awesome icons with PW? E.g. "fa-search, title" in the "List of fields to display in the admin Page List" would, in the page tree, display the title and the search icon next to the pages that use that template. Is that what you are asking? Edit: Hmm.., reading this again, it seems you want to use custom icons? Edited February 19, 2014 by kongondo
nghi Posted February 20, 2014 Author Posted February 20, 2014 You know you can now (PW 2.4) use font awesome icons with PW? E.g. "fa-search, title" in the "List of fields to display in the admin Page List" would, in the page tree, display the title and the search icon next to the pages that use that template. Is that what you are asking? Yes kind of, I can get the font awesome icons to appear but I only want icons to appear within certain conditions. So at first glance a user can tell if a page is being feature base on a date range.
kongondo Posted February 20, 2014 Posted February 20, 2014 OK. Sorry, I can't help much further; I don't know how to accomplish conditional styling in the admin...
horst Posted February 20, 2014 Posted February 20, 2014 (edited) You may do this by a module like that: public function init() { $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageListLabelItems'); } public function addPageListLabelItems($event) { $page = $event->arguments('page'); // then you do your conditionals and your styling, like for example: if($page->myField >= $myMinValue && $page->myField <= $myMaxValue) { // add your styling here } // or like that: if('architekt'==$page->template) { // add the styling here $styleItem = $page->ortarchitekt == '' ? ' <span class="jhpPageListItemEmpty"><strong style="color:white">kein Ort eingetragen</strong></span> ' : ''; // now add the new style item to the existing output $event->return = $event->return . $styleItem; } } This way I get outputs like that: EDIT: Ah, have found it: here is a module from Soma: http://modules.processwire.com/modules/page-list-image-label/ that adds a Thumbnail to the list. That was the startingpoint for my customized PagetreeList. If you are not (yet) familiar with modules please have a look to the HelloWorld-Module or ask here for further assistance Edited February 20, 2014 by horst 8
alexcapes Posted June 19, 2015 Posted June 19, 2015 Apologies this was a post in the wrong thread. This is where I posted my solution to creating dynamic icons (based on horst's example) https://processwire.com/talk/topic/10213-dynamic-template-icon-based-on-field-value/
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