diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-10-17 12:08:21 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-10-17 12:08:21 +0000 |
commit | 0e9dda10b979b2284be7fbc8b2c662414f1bf7ad (patch) | |
tree | 5c4c006eb97a094afa65b874f8d8a4f87e18c06b /modules/taxonomy/taxonomy.module | |
parent | f179b1f7c6d0282998d05c6233fe90e4aa66189f (diff) | |
download | brdo-0e9dda10b979b2284be7fbc8b2c662414f1bf7ad.tar.gz brdo-0e9dda10b979b2284be7fbc8b2c662414f1bf7ad.tar.bz2 |
- Patch #25801 by jweowu, marcp: taxonomy_select_nodes() hard codes limit.
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index fb02663bb..831c128a3 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -84,17 +84,20 @@ function taxonomy_entity_info() { * and will return an empty array if it is not. If using other field storage * methods alternatives methods for listing terms will need to be used. * - * @param $term - * The term object. + * @param $tid + * The term ID. * @param $pager * Boolean to indicate whether a pager should be used. + * @param $limit + * Integer. The maximum number of nodes to find. + * Set to FALSE for no limit. * @order * An array of fields and directions. * * @return * An array of nids matching the query. */ -function taxonomy_select_nodes($term, $pager = TRUE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) { +function taxonomy_select_nodes($tid, $pager = TRUE, $limit = FALSE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) { if (!variable_get('taxonomy_maintain_index_table', TRUE)) { return array(); } @@ -104,15 +107,18 @@ function taxonomy_select_nodes($term, $pager = TRUE, $order = array('t.sticky' = $count_query = clone $query; $count_query->addExpression('COUNT(t.nid)'); - $query = $query - ->extend('PagerDefault') - ->limit(variable_get('default_nodes_main', 10)); + $query = $query->extend('PagerDefault'); + if ($limit !== FALSE) { + $query = $query->limit($limit); + } $query->setCountQuery($count_query); } else { - $query->range(0, variable_get('feed_default_items', 10)); + if ($limit !== FALSE) { + $query->range(0, $limit); + } } - $query->condition('tid', $term->tid ); + $query->condition('tid', $tid); $query->addField('t', 'nid'); $query->addField('t', 'tid'); foreach ($order as $field => $direction) { |