Spica Posted October 2, 2015 Posted October 2, 2015 I very often need a selector like this$matches = $page->find("parent=1020")->not("template=product"); $matches = $page->find("parent=1020, template!=product"); I have to make sure, that certain pages do not get selected, in this case those with template=product. To avoid to accidentically include these pages I thougt about adding the restricting selector globally by a hook with the possibility to explicitely include it when needed. At the moment I think to 1. hook before 2. supplement arguments(0) with "template!=product" 3. return if in arguments(0) is e.g. a "include=product" (which should be ignored later on by the find method) So, is that a good proccedure or would you recommend another?
LostKobrakai Posted October 2, 2015 Posted October 2, 2015 How about simply hiding the products, so they are only shown when adding "include=hidden".
Spica Posted October 2, 2015 Author Posted October 2, 2015 yes. thought about that too. but is not solid enough as others may set filters without reflecting to exclude hidden product templates as hidden means all hidden pages. I realy want to make sure the pages could not be selected unless they are explecite included.
LostKobrakai Posted October 2, 2015 Posted October 2, 2015 Then your already on the right track with hooking Pages::find or maybe even PageFinder::find.
Spica Posted October 4, 2015 Author Posted October 4, 2015 ok. Didnt know PageFinder::find. What is the difference to Pages::find. Cannot see any difference for normal use.
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