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);
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

b2f’s picture

Title: Pagination limit variable not configurable in core modules. » Pagination limit configuration change in core modules.
Component: taxonomy.module » configuration system
Status: Active » Needs review

Alright 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 :

  $form['front_page']['default_nodes_main'] = array(
    '#type' => 'select', '#title' => t('Number of posts on front page'),
    '#default_value' => variable_get('default_nodes_main', 10),
    '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
    '#description' => t('The maximum number of posts displayed on overview pages such as the front page.')
  );

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.

b2f’s picture

b2f’s picture

Assigned: b2f » Unassigned
dawehner’s picture

Version: 7.x-dev » 8.x-dev
Component: configuration system » system.module

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

b2f’s picture

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

magnusk’s picture

The 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()

jodeygrist’s picture

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

b2f’s picture

FileSize
25.79 KB
10.64 KB

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

misleading_setting

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.

pager exemple

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.

b2f’s picture

Priority: Normal » Minor
h3rj4n’s picture

Seems 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:

./modules/taxonomy/taxonomy.pages.inc:46:  if ($nids = taxonomy_select_nodes($term->tid, TRUE, config('node.settings')->get('items_per_page'))) {
./modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php:215:      $items_per_page = $query->get('items_per_page');

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.

b2f’s picture

Priority: Minor » Normal
jhedstrom’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll
rpayanm’s picture

Status: Needs work » Needs review
FileSize
1.01 KB
jhedstrom’s picture

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

swentel’s picture

Status: Needs review » Closed (won't fix)