Set $page to the user-visible container page if the hanna code is in a repeater field#7
Open
jlj wants to merge 1 commit intoryancramerdesign:masterfrom
Open
Set $page to the user-visible container page if the hanna code is in a repeater field#7jlj wants to merge 1 commit intoryancramerdesign:masterfrom
jlj wants to merge 1 commit intoryancramerdesign:masterfrom
Conversation
…a repeater field
Also added a $group variable to refer to the repeater page (null if the
field is not in a repeater).
Note: no change has been done to $this->page to avoid side effects.
This means that $page, $hanna->page and wire("page") may have different
values.
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.
Hi Ryan,
This proposal is intended to address an issue I ran into and which will bed best described by the corresponding PW forum message: http://processwire.com/talk/topic/3745-hanna-code/page-7#entry54326
Although having $page set to the repeater page where the field is located is consistent with other parts of PW like the repeater templates, it can be confusing for the user not-so-aware-of-pw-internals.
And it makes the writing oh hanna codes more complex if you have to check for the repeater case inside the hanna code itself.
So IMO it would be better to have 2 separate variables to handle the various levels in the repeater case.
I've put it in a certain way here, but other options may be just as good:
Also added a $group variable to refer to the repeater page (null if the field is not in a repeater).
Note: I haven't done any change to $this->page to avoid unwanted side effects, mainly because of my limited knowledge of PW. This means that $page, $hanna->page and wire("page") may have different values.
This may need to be changed in an released version. ;-)
Thanks for having a look at this pull-request
Jean-Luc