Repository navigation
Add counter: and iteration: options to with_collection_parameter - #2723
Closed
bensheldon wants to merge 1 commit into
Closed
bensheldon wants to merge 1 commit into
bensheldon wants to merge 1 commit into
Conversation
counter: and iteration: options to with_collection_parameter
bensheldon
force-pushed
the
collection-parameter-counters
branch
from
October 12, 2026 14:23
cf9cc0c to
9654962
Compare
bensheldon
force-pushed
the
collection-parameter-counters
branch
from
October 12, 2026 14:31
9654962 to
de3e0a0
Compare
Member
|
@bensheldon to be honest, I'm on the fence about this one. While I can see the argument for adding explicit options here, I have two reservations:
With that in mind, I'm going to close the PR for now. If you have specific cases that do not with with the improved introspection, I'd accept them as evidence for this change. |
Contributor
Author
|
@joelhawksley no worries! that makes sense. Just to document the issues with method signature detection:
|
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.
This is the second of the PRs I described in #2722: an explicit way to declare that a component receives the
_counter/_iterationparameters when rendered as a collection. If/when #2722 merges, I will resolve any conflicts with this PR.Today, whether a component receives them depends on ViewComponent introspecting its
initializesignature. This PR adds an explicit declaration as an alternative to introspection.My end goal is for the explicit declaration to become the only way to opt into the collection _counter/_iteration feature, with introspection deprecated in a follow-up if/when this PR is accepted.
What it does
Adds
counter:anditeration:options towith_collection_parameter, and makes the parameter name optional:counter:anditeration:each taketrue(always pass),false(never pass), ornil(the default, which keeps today's signature-based behavior so this is backwards compatible).with_collection_parameter counter: trueafterwith_collection_parameter :itemkeeps:item.Other details
contentchecks still read the signature.