Field Longtext Pager
This module allows you to break down long text fields into multiple, easily navigable pages. It intelligently handles complex HTML and offers features like an index, estimated reading time, and smooth Ajax paging.
This module provides a field formatter for splitting large longtext field content into more readable, indexed sub-pages as defined by pagebreaks, or a specific number of characters, words, or HTML blocks.
It also provides additional optional display features:
- Pager index field
- Estimated reading time field
- Ajax paging
Requirements
- Drupal 10, 11, or 12.
Recommended Modules
Installation
- Install as you would normally install a contributed Drupal module.
composer require drupal/field_longtext_pager
To set module default settings visit:
<YOUR-SITE-URL>/admin/config/content/field_longtext_pager
You must ensure that your text formats and editors allow your page break placeholder.
The default example is:
<!--pagebreak-->There are CKEditor plugins available to enable manual pagebreak insertion.
To enable paging on your field, visit the "Manage display" options in your entity field settings:
/admin/structure/types/manage/<ENTITY-ID>/display
Select the "Field pager" format option and choose your desired settings.
Ajax pager results currently use the "Full page" view to return results, falling back to the "Default" view when not found, which is often the case with entities such as comments.
The pager IDs are automatically incremented from the setting defined in the field options when multiple entities using paged fields are displayed on the same page. Reserve your highest pager ID settings for your primary fields in this scenario.
Technical Description
The algorithms are designed to split complicated HTML markup smartly. For example, it safely takes this:
<div class="text-important"> <p class="info"> Long content paragraph... <!--pagebreak--> Continuation of long content paragraph. </p> <ul class="text-note"> <li>List #1</li> <li>Long list #2... <!--pagebreak--> Continuation of long list #2</li> <li>List #3</li> </ul> </div>
And cleanly splits it into this:
<div class="text-important"> <p class="info"> Long content paragraph... </p> </div> ------------Page 1------------ <div class="text-important"> <p class="info"> Continuation of long content paragraph. </p> <ul class="text-note"> <li>List #1</li> <li>Long list #2...</li> </ul> </div> ------------Page 2------------ <div class="text-important"> <ul class="text-note"> <li>Continuation of long list #2</li> <li>List #3</li> </ul> </div> ------------Page 3------------
Maintainers
- Dan Greenman - Freelance full-stack developer for hire.
dangreenman
Commission your wildest Open Source software dreams.
See: Portfolio
Support This Project
If you find this module useful and would like to support its continued development, please consider making a donation. Your contributions help cover server costs, fund new features, and allow me to dedicate more time to maintaining this open-source project.
Donations are accepted in the following cryptocurrencies:
Coin Network Address Bitcoin BTC Mainnetbc1qwtnf888phavjuulj5y6ryvcgpyscckzt5gfu5p
Monero
XMR Mainnet
44KTVNFzSmC12srxKgxvCEbmUXSzjNmT1NAHRpF9tuhvCDMpsimTZerAxPr4pNrtT7EjqN45WKerrAh1K9UgKayR9ogksYm
ZCash
ZEC Mainnet
t1g1zSTxGBtQJcQtdum52tXd2bBp8WkrbkG
Note: Network fees may vary depending on the cryptocurrency and current network congestion. Please ensure your donation amount accounts for these fees to avoid delays or failed transactions.