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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swentel’s picture

Status: Needs review » Closed (duplicate)
Jelle_S’s picture

Status: Closed (duplicate) » Needs review

I'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...

Status: Needs review » Needs work

The last submitted patch, nodefilter.patch, failed testing.

brettbirschbach’s picture

Status: Needs work » Needs review
FileSize
2 KB

I 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?