Problem/Motivation

In our project we noticed that although we specified 9 items only 2 items were shown. The original collection contained over 100 items though. It turned out that the first 9 items contained 7 unpublished ones.

Proposed resolution

The proposed solution is to let the Field Limiter module iterate over the available items untill the desired number of items is available in the output. The patch contains the code that is tested to work on our client project.

CommentFileSizeAuthor
#2 field_limiter-3050938-1.patch2.44 KBAnonymous (not verified)

Comments

Anonymous’s picture

Gerben Spil created an issue. See original summary.

Anonymous’s picture

StatusFileSize
new2.44 KB

Here is the patch.

nginex’s picture

Version: 8.x-1.0 » 2.0.x-dev
Status: Active » Needs review
rollins’s picture

I installed fresh Drupal 10 and field_limiter module
To the Basic page content type, I added a reference to the Article content type
Created 5 Articles (2 published and 3 unpublished)
Configured Limit for the reference field formatter to show 4 items
and it shows the correct 4 Article titles, including published and unpublished nodes
Tested several other cases, and every time module worked as expected

  • nginex committed 32020f69 on 2.0.x
    Issue #3050938 by Gerben Spil: Field limiter does not always output the...
nginex’s picture

Status: Needs review » Fixed

Thanks guys for patching and testing

nginex’s picture

Status: Fixed » Closed (fixed)

This is now available in 2.0.1