We needed the ability to have more complex filters for our content, namely:
- comparison operators other than 'is' and 'is not' (e.g. 'is before', 'is after', 'contains', etc); and
- input fields other than select lists (like 'date', or 'textfield')
To do this the filter array returned by hook_node_admin_filters() was extended to support a 'comparisons' parameter for listing the available comparisons to choose from. If not included it would use the default: array(1 => 'is', 0 => 'is not'). Additionally a 'type' parameter can be used to specify and alternative form element type.
For example:
function hook_node_admin_filters() {
return array(
'created' => array(
'type' => 'date',
'title' => t('Created Date'),
'callback' => 'node_filter_created',
'comparisons' => array('=' => 'is', '<>' => 'is not', '<' => 'is before', '>' => 'is after'),
),
);
}
Allowing for additional element types means we can no longer assume that there is an 'empty' state for that type to exclude it from queries (like what happens with the select type). To work around this the interface was changed to support the dynamic adding and dropping of filters as logged in #239069: Improve filter UI
The included patch was made against HEAD.
The patch was developed by IDG Australia
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | better_node_admin_content_additions_2.patch | 8.92 KB | triclops |
| better_node_admin_content_additions.patch | 6.64 KB | triclops |
Comments
Comment #1
triclops commentedNew patch.
Changes made: