Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 patch attached introduces a '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:
/**
* Implementation of hook_node_filters().
* Returns extra filter option at admin/content/node to filter on every page.
*/
function testmodule_node_filters() {
$result = db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.type = 'page'"));
while ($row = db_fetch_object($result)) {
$options[$row->nid] = $row->title;
}
return array('page' => array('title' => 'page', 'options' => $options, 'where' => 'n.nid = %d', 'join' => ''));
}
Hope this isn't a duplicate request.
Kris
Comment | File | Size | Author |
---|---|---|---|
#4 | node_admin_filters-241964-4.patch | 2 KB | brettbirschbach |
nodefilter.patch | 833 bytes | swentel | |
Comments
Comment #1
swentel CreditAttribution: swentel commentedclosing it myself, cf http://drupal.org/project/better_node_admin_content
Comment #2
Jelle_SI'd like to reopen this since the module you point to has only 1 commit, no D7 version, and that specific commit was from 3 years ago...
Comment #4
brettbirschbach CreditAttribution: brettbirschbach commentedI had a need for this functionality as well, so I rolled a new patch.
Is there additional work I need to do in order to make this worthy of adding to core?