Extend node filters form
I've been wanting to extend the default node_filter_form on admin/content/node since ages so I finally wrote my own patch because I really needed it for some projects. The patches attached introduce a new hook called hook_node_filters. Modules can hook into the default node_filters function to add their own select boxes and types to filter on. An example hook could look like this:
<?php
/**
* Implementation of hook_node_filters().
* Returns extra filter option at admin/content/node to filter on every page.
*/
function testmodule_node_filters() {
$q = "SELECT n.nid, n.title FROM {node} n WHERE n.type = 'page'";
$result = db_query(db_rewrite_sql($q));
while ($row = db_fetch_object($result)) {
$options[$row->nid] = $row->title;
}
return array('page' => array(
'title' => 'page',
'options' => $options,
'where' => 'n.nid = %d',
'join' => '')
);
}
?>Although I'm pretty sure this patch is safe, this is not an official patch reviewed by the Drupal community. In the event something might go wrong, don't hold me responsible allright ? ;) Also, take a look at http://drupal.org/project/better_node_admin_content which will hopefully serve as a patch for D7.
