Skip to content

Conversation

@jlj
Copy link

@jlj jlj commented Feb 17, 2014

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:

  • $page is the user-visible page containing the field where the hanna code is
  • $group is the repeater page containing the field (or null)
  • wire("page") is the rendered page

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

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant