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 was searching a way to change the 10 nodes limit by page for taxonomy terms, I found it is set by a persistent variable named "default_nodes_main". In fact I did a quick search across all core files and didn't found its setter (variable_set("default_nodes_main", n)), only getters. Maybe we should make it configurable in the admin GUI somewhere, or did I miss this functionnality ?
If it's something we should add to core admin, I'd like to help.
In taxonomy.pages.inc, line 44:
if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) {
$nodes = node_load_multiple($nids);
$build += node_view_multiple($nodes);
Comment | File | Size | Author |
---|---|---|---|
#13 | 1424262-13.patch | 1.01 KB | rpayanm |
#10 | drupal-change_default_pagerlimit-1424262-2.patch | 967 bytes | h3rj4n |
#8 | old title.png | 10.64 KB | b2f |
#8 | pager exemple.png | 25.79 KB | b2f |
#2 | drupal--system-admin-default-nodes-main-description-1424262-1.patch | 981 bytes | b2f |
Comments
Comment #1
b2f CreditAttribution: b2f commentedAlright I think I found it ! It's in admin system informations. Maybe the title ("Number of posts on front page" ) of its select is a little missleading.
system.admin.inc, line 1457 :
Any of you would agree to change t('Number of posts on front page') to something like t("Maximum number of posts per pages") ?
I am going to make a patch.
Comment #2
b2f CreditAttribution: b2f commentedComment #3
b2f CreditAttribution: b2f commentedComment #4
dawehnerI think that strings shouldn't be changed in d7, because the strings are freezed even before the release of drupal.
One thing i'm wondering here is that this code is directly in system not in node, as this is definitive something related to node.
Comment #5
b2f CreditAttribution: b2f commentedYou're right it's about nodes, maybe they didn't realise the usefulness of this setting and how it can be related to other purpose than just "posts on front page" like suggested. That's why in my patch I proposed the string title "Maximum number of nodes per page" instead.
Comment #6
magnusk CreditAttribution: magnusk commentedThe number of nodes per page should be distinct and independent between the default front-page display and the term-page display.
Further, if one wanted to display all nodes in term page views, one would want to set the term page pager limit (currently the variable 'default_nodes_main') to FALSE, which the current admin settings don't offer.
@see taxonomy_term_page()
Comment #7
jodeygrist CreditAttribution: jodeygrist commentedWe've just come across this same problem in Drupal 7, and I think there should be 2 distinct settings, a maximum number of terms to display per page (with an unlimited option too), and a checkbox to enable paging.
I personally would like that functionality backported to D7 if it gets implemented as it's quite an important setting.
Comment #8
b2f CreditAttribution: b2f commentedI'll try to explain this clearer, because it seems worse than I thought.
The issue is related to the actual default page limit, its administration's setting located in Site information (which is OK) is named "Number of posts on front page" which seems totally missleading, because what has been called "Number of posts on front page" is really the default pager elements limit set by the persistent variable
'default_nodes_main'
.Indeed, the persistent variable named 'default_nodes_main' is used to define the default pager's element per page limit for just any page element, not only front pages or nodes.
For exemple I am working on a module with a table generated with (theme_table) in which I insert rows composed of string and date types. Rows data is retrieved by a PagerDefault query :
->db_select("...")->extend('PagerDefault');
And the form has a pager control :
$form['pager'] = array('#theme' => 'pager');
Its page limit is not related to nodes, yet it is configured by the "Number of posts on front page" setting.
The administration field name should be changed to something like "Pager elements limit" with a description similar to "ie. the Number of posts on front page", to improve both users and developpers experience.
Comment #9
b2f CreditAttribution: b2f commentedComment #10
h3rj4n CreditAttribution: h3rj4n commentedSeems that this part of the settings form is relocated to the node module. Don't think this is the best place for this option. If it's still true what is said above this variable isn't only used on for the display of the nodes, it's also used for the default pager. Other entities / (custom) code can depend on this variable, not only the node module:
I've looked trough the code but I cant find a getter for this variable but the default pager still uses this variable. Tested it by setting the pager setting to 1 item and it really did show one item on the front page.
I created a patch containing the right form ID which should be altered and the suggested title for this option. As pointed out, I'm not happy with the current location of the form alter and the display of the form setting.
Comment #11
b2f CreditAttribution: b2f commentedComment #12
jhedstromComment #13
rpayanmComment #14
jhedstromI wonder if it is too late to move this code into the system module? As mentioned above, this setting impacts far more than just the number of posts on the front page.
Comment #15
swentel CreditAttribution: swentel commentedThis is being removed in #2401035: items_per_page in node.settings is no longer used