fix(blocks): add offset option to Pods Item List and Related Item List blocks#7560
Open
faisalahammad wants to merge 1 commit into
Open
fix(blocks): add offset option to Pods Item List and Related Item List blocks#7560faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
…t blocks - Add offset field to Item_List block fields so users can skip items. - Add offset field to Related_Item_List block fields for consistency. - Map the offset shortcode attribute in the Item_List block transform. - Sync offset attribute in pods-block-list block.json metadata. The underlying Pods shortcode and data layer already support offset, so this change only exposes the existing parameter through the block UI. Fixes pods-framework#7523
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an Offset field to the Pods Item List and Related Item List blocks, allowing users to skip a number of items when listing the same pod in multiple places. The underlying
[pods]shortcode and data layer already support offset, so this only exposes the existing parameter through the block UI.Fixes #7523
Changes
Item List block
Before:
No offset field; users could only set a limit.
After:
Added
offsetfield (type number, default 0) insrc/Pods/Blocks/Types/Item_List.phpand mapped it in the shortcode transform. Addedoffsetattribute toui/js/blocks/block-types/pods-block-list/block.json.Why: Lets users skip N items before rendering the list without writing a custom shortcode.
Related Item List block
Before:
No offset field.
After:
Added
offsetfield (type number, default 0) insrc/Pods/Blocks/Types/Related_Item_List.php.Why: Same list block family, uses the same shortcode path and limit field.
Testing
Test 1: Item List block with offset
Result: shows items 2-3, skipping item 1.
Test 2: Related Item List block with offset
Result: skips first related item and shows next 2.
Test 3: Shortcode transform
[pods name="my_pod" limit="2" offset="3" template="my_template"].Result: Offset field shows 3.
Also ran
php -lon changed files, validated JSON, and rannpm run build-productionsuccessfully. JS lintnpm run lint-jsfails due to a pre-existing missing parent eslint config (wordpress), not from this change.