Jump to content

Selecting specific repeater items from other pages (kinda like page reference field)


Stefanowitsch
 Share

Recommended Posts

Hi have a general question if this would be possible:

I have a page that contains a repeater. This repeater holds an image and a cite for each repeater item.

On the page itself all repeater items (= all cites) should be visible in a carousel.

But on other pages I would like to select a specific single (!) cite from that repeater to be shown. This cite should be selectable from a list, not just hard coded as a ProcessWire selector with the ID of the repeater item...

I know that this could be achieved with a page reference field. But in that case I can't make use of the repeater field but instead have to create a subpage for each cite I want to add. The repeater solution seems to be more straight forward.

Link to comment
Share on other sites

45 minutes ago, Stefanowitsch said:

I know that this could be achieved with a page reference field. But in that case I can't make use of the repeater field but instead have to create a subpage for each cite I want to add.

I don't think that this is true ? Repeater items are just regular PW pages. They are hidden in the page tree somewhere under the admin page. It should then be possible to create a page reference field with a selector like "parent=123,include=all"

Where 123 is the id of the page that holds your repeater items. Not sure if the include=all is necessary, just try it without.

  • Thanks 1
Link to comment
Share on other sites

3 hours ago, bernhard said:

I don't think that this is true ? Repeater items are just regular PW pages. They are hidden in the page tree somewhere under the admin page. It should then be possible to create a page reference field with a selector like "parent=123,include=all"

Where 123 is the id of the page that holds your repeater items. Not sure if the include=all is necessary, just try it without.

Wow, it does indeed work!

All you have to to is 

1. Create a page reference field
2. Select the parent page in the field settings (which is the repeater page in that case, hidden under the admin site in the page tree!)
3. Now you can select the repeater items from there like a page reference

The only drawback is that this list shows the programmatic created names that are used for the repeater item pages by the system.

image.png.5a3f886a250d283ce8ff4053969c8dda.png

THIS can be solved by changing the label in the field settings:

image.png.b291a3b72ffd7423a3d78ff557530a9e.png

image.png.e1c43f5bf5b31c7554a6c17c83bc8a01.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...