I have a multiselect field of ‘artists’ which lets the user pick 5 artist pages:
label: Pick 5 artists
In addition to that I have a second field of ‘5 book picks’ that lets the user pick 5 book pages:
label: Pick 5 book recommendations
each book from the picks has an artist field with artist page as a value. I wish to collect all the artist pages from the ‘5 book picks’ and make it as the value of the first field (multiselect field of ‘artists’).
On top of it, if possible, I wish that this automatically filled field (‘artists’) will be invisible in the panel.
In template I managed (thanks to the forum) to get the artist value of each book:
$recommended_books = $page->recommendations()->toPages(',');
$pick_artists = $recommended_books->pluck('artist', ',', true);
But how can I use it in the panel?
Thanks a lot!
Why do you want to have the artists field in the panel if you don’t want people to see or edit it?
Well, all pages have artist field. But this specific page doesn’t have one artist but 5, these are the artists of the the 5 book picks.
at the end of every page I show related pages according to artist field so I need this page to have artist field as well.
Right now it works good - the user pick 5 artists and 5 books separately. But I don’t want this double multi-selection. If only the artists from the books would be filled automatically in the artist field then I could save the user from filling it twice. Also the lists of artists and pages are big and might be confusing and I don’t want them to fill wrong artists.
I hope I’m understood
I’d still recommend to remove the “pick 5 artists” field from the blueprint.
I mean you already seem to have a separate blueprint for that kind of page.
I’d move the problem to the template, or to a model, or to a controller. Specifically to where you generate the “related pages”; because you anyway need special logic to generate those if you suddenly have 5 artists instead of only 1.