En dev registry system filters
semuel edited this page Dec 28, 2011
·
5 revisions
The system_filters option let you define built-in filters
- condition
- A subroutine that determine if this filter should be available in this context
- view
- The Scope that this filter should be available in
- label
- The name of the filter
- order
- Specify order – the lower the number the higher it will appear
- items
- The filtering specification. see below for details
Built-in filter, like the user-defined counterparts, can combine multiple filters to achieve the desired view. There filters are specified in the items
field, (there can be more then one) and each have two sub-fields: type
– the object property that this filter works on, and args
– a hash simulating the the parameter sent from the web page when a user applies a filter
[
{
type => 'foo',
args => {
option => 'equal',
value => 'Hoge',
}
},
]
If the filter label begins with an underscore, the filter become hidden, and is only available with as HTTP request parameter.
This is used, for example, to show comments-for-entry listing. (in manage entries screen, click on the comments count)
The URL should be built as:
mt.cgi?__mode=list&_type=comment&blog_id=0&filter_key=_comments_by_entry&filter_val=1