Open edalzell opened 2 years ago
This hurts my brain.
We have what we call a "super" menu:
Issue is that each of those menus needs to handled differently, for example one looks like this:
and another:
and yet another:
So each of these needs a type
so we can pull in the correct partial. Not only that, some of those type have specific fields we want to show for the items (like an asset
field on the ones w/ pictures), but NOT show on the other menu types.
So it would be loverly to be able to attach the blueprint to the nav itself and not the items, but have the item blueprint be aware of the nav type, so we can show/hide fields. Alternatively, if we could have multiple nav item blueprints, that would also work.
Just kidding i get it now, thanks! <3
I need a lot more flexibility for navigations as well. I need to be able to disable external links for some navigations, and others I need customized blueprints for both internal and external links.
In this example I had to remove the built-in connection to collection and completely overtake the blueprint, as I was fighting against the CP handling
sections:
main:
display: Main
fields:
-
handle: link_type
field:
type: radio
display: Type
options:
intern: Intern
extern: Extern
inline: true
validate:
- required
-
handle: title
field:
type: text
display: Title
validate:
- required
-
handle: intern
field:
type: entries
display: Intern
max_items: 1
create: false
collections:
- hotels
validate:
- 'required_if:link_type,intern'
if:
link_type: intern
-
handle: url
field:
type: text
display: Extern
placeholder: 'https://varbergskusthotell.se/'
validate:
- 'required_if:link_type,extern'
- sometimes
- nullable
- url
if:
link_type: extern
-
handle: region
field:
type: terms
display: Region
create: false
max_items: 1
mode: select
taxonomies:
- regions
validate:
- 'required_if:link_type,extern'
if:
link_type: extern
-
handle: city
field: common.label
config:
display: City
if:
link_type: extern
-
handle: map
field:
type: assets
display: Map
allow_uploads: false
container: main
folder: /maps
max_files: 1
mode: grid
restrict: true
Use Case:
Would be great to be able to attach this data to the nav via a blueprint.
Current workaround is to either make an assumption (leads to more fragile code), or making a top level item with some data, and therefore not used fields on the items.
Secondarily, need to be able to show/hide fields based on a Nav's
type
.