Jump to content

hook into $page->find


Spica
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...