Forum
Page Attributes and Collections
Is it possible in Runway to have a page attribute where the options available to the content editor are selected from a collection?
The scenario is that I would like editors to be able to create a collection of themes with items such as page colour, banner image, banner size, etc and give the theme a meaningfull name. When creating a page they could then select a single theme name as a page attribute.
Creating the collection is fine but I'm struggling with how to get the collection into the attributes template.
I've not tried it, but you might be able to do this with
<perch:related>
https://docs.grabaperch.com/runway/relationships/
Drew Thanks, I have some progress. I have an attributes template with the follwing contents:
This produces a "multi-select" type field in Admin Page Details but I've not been able to make it a "select" or "radio" field type which would be much more appropriate. It is workable but just not very elegant from the user perspective.
The value stored in the page's pageAttributes array is the collection's itemID so easy enough to work with.
Any suggestions?
Thanks again. Kevin
You can add
max="1"
to yourperch:related
tag which will only allow one selection to be made.Duncan
Excellent, thank you. I never realised that was there.
I can see quite a lot of uses for this.
Now if only there was some way to specify a default value :-)
Kevin
Try using the
default="item_id"
tag and see if that works. Substitute the actual id of "Theme Three" (or whichever one should be the default) foritem_id
.it might work.