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 would like to have the option to exclude a node within the node itself, using a custom checkbox-field. Integrating this with nodes instead of keeping it with the general pagination settings has some advantages. It
- eases on usability (option affects a node, so one would edit it within that node)
- prevents from having orphaned nid's in the comma separated list (as data from a custom field gets deleted when the node itself is deleted)
I propose the following two lines to be added in pagination.module's function pagination_node_view, directly after
$ignore = array_map('trim', explode(',', variable_get('pagination_ignore', '') ) );
/**
Checks whether current page should have pagination.
> Default: all pages of $node->type have pagination
> When field_disable_pagination is checked, add nid to $ignore
**/
if ($paging && (bool) $node->field_disable_pagination['und'][0]['value'])
$ignore[] = $node->nid;
The only thing needed besides this, is a custom field named field_disable_pagination on nodes that have pagination enabled, with unchecked value 0 and checked value 1.
Comments
Comment #1
mundanity CreditAttribution: mundanity commented