- Patch #25801 by jweowu, marcp: taxonomy_select_nodes() hard codes limit.
parent
f179b1f7c6
commit
0e9dda10b9
|
@ -84,17 +84,20 @@ function taxonomy_entity_info() {
|
||||||
* and will return an empty array if it is not. If using other field storage
|
* 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.
|
* methods alternatives methods for listing terms will need to be used.
|
||||||
*
|
*
|
||||||
* @param $term
|
* @param $tid
|
||||||
* The term object.
|
* The term ID.
|
||||||
* @param $pager
|
* @param $pager
|
||||||
* Boolean to indicate whether a pager should be used.
|
* 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
|
* @order
|
||||||
* An array of fields and directions.
|
* An array of fields and directions.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* An array of nids matching the query.
|
* 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)) {
|
if (!variable_get('taxonomy_maintain_index_table', TRUE)) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
@ -104,15 +107,18 @@ function taxonomy_select_nodes($term, $pager = TRUE, $order = array('t.sticky' =
|
||||||
$count_query = clone $query;
|
$count_query = clone $query;
|
||||||
$count_query->addExpression('COUNT(t.nid)');
|
$count_query->addExpression('COUNT(t.nid)');
|
||||||
|
|
||||||
$query = $query
|
$query = $query->extend('PagerDefault');
|
||||||
->extend('PagerDefault')
|
if ($limit !== FALSE) {
|
||||||
->limit(variable_get('default_nodes_main', 10));
|
$query = $query->limit($limit);
|
||||||
|
}
|
||||||
$query->setCountQuery($count_query);
|
$query->setCountQuery($count_query);
|
||||||
}
|
}
|
||||||
else {
|
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', 'nid');
|
||||||
$query->addField('t', 'tid');
|
$query->addField('t', 'tid');
|
||||||
foreach ($order as $field => $direction) {
|
foreach ($order as $field => $direction) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ function taxonomy_term_page($term) {
|
||||||
'#suffix' => '</div>',
|
'#suffix' => '</div>',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($nids = taxonomy_select_nodes($term)) {
|
if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) {
|
||||||
$nodes = node_load_multiple($nids);
|
$nodes = node_load_multiple($nids);
|
||||||
$build += node_build_multiple($nodes);
|
$build += node_build_multiple($nodes);
|
||||||
$build['pager'] = array(
|
$build['pager'] = array(
|
||||||
|
@ -71,7 +71,7 @@ function taxonomy_term_feed($term) {
|
||||||
// Only display the description if we have a single term, to avoid clutter and confusion.
|
// Only display the description if we have a single term, to avoid clutter and confusion.
|
||||||
// HTML will be removed from feed description, so no need to filter here.
|
// HTML will be removed from feed description, so no need to filter here.
|
||||||
$channel['description'] = $term->description;
|
$channel['description'] = $term->description;
|
||||||
$nids = taxonomy_select_nodes(array($term->tid, FALSE));
|
$nids = taxonomy_select_nodes($term->tid, FALSE, variable_get('feed_default_items', 10));
|
||||||
|
|
||||||
node_feed($nids, $channel);
|
node_feed($nids, $channel);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue