Jump to content


Photo

Some thoughts/informations on selectors

filter selector api button head

  • Please log in to reply
No replies to this topic

#1 MadeMyDay

MadeMyDay

    Sr. Member

  • Members
  • PipPipPipPip
  • 142 posts
  • 127

Posted 25 May 2012 - 10:13 AM

While developing my dashboard module I came across a lot of difficulties when building a configurable filter for selecting pages for the last pages widget. Some things I discovered:
  • "or" filter in native page fields didn't work. Fixed by Ryan in the last commit (Big thanks!): https://github.com/r...1c1a5df1a572169
  • It is was somehow difficult/impossible to use get('/')->find(...). This resulted in weird results where direct children were not in the results array. Should also be fixed (not tested).
  • There is an undocumented selector "has_parent" which looks for a parent up to the root. Quite handy! So "has_parent!=2" removes all admin pages (except admin itself, add id!=2 for that) from a select (thanks @Soma!).
  • The "user" which created the standard pages is not the superuser. This was the reason I doubted my results because I thought the superuser would have created everything. Me stupid.
  • The inputFieldSubmitButton module generates a button which gets doubled in the admin head section. Couldn't find the place where this happens until I found out that this is generated with Javascript. Me stupid again.
  • Important rule for selectors: First "has_parent" (if needed), second "include=all" (if needed), then the other filters. And in the end "sort" and then "limit". Not sure about this, but this works for me, so I have only one selector which seems to be correct. For example the latest pages for a specific user which are not admin pages (and no trash):
has_parent!=2,id!=2|7,include=all,created_users_id|modified_users_id=41,sort=-modified,limit=10




Looks easy, but wasn't (at least for me) ;)





Also tagged with one or more of these keywords: filter, selector, api, button, head

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users