Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Admin: editable dropdowns/selects?

Started by Muut Archive 10 years ago · 5 replies · 434 views
10 years ago

Hi guys. I would like to ask about a functionality, which would be very handful in my case and it would save a lot of time.
Is there a possibility to define some set of values in admin for some page and then use it in another place as dropdown or select? As an example here's the screenshot:

Grav

But on provided screenshot these items are hardcoded in blueprint. What I need is to make some list of them, for example in another tab, and then they will appear in a place where needed, so I can assign it.

Hopefully I'm clear. Is it possible? Thanks in advance.

10 years ago

I have the same desire. IN my case it is more like this:
I have a custom tab in the config called "Brand" with global brand settings, for example brand colors, then in different pages/sections I need to be able to choose from a list of those brand colors, so being able to list the values set from one config file as options in a select field on another page would be ideal. Something like:

YAML
type: select
label: Section Brand Color
default: primary
options:
  'config.brand.primaryColor': Primary
  'config.brand.secondaryColor': Secondary
  'config.brand.tertiaryColor': Tertiary

Being able to display the actual color value in the select would be even more rad, but one thing at a time I guess!
@fandorin — sorry for piggybacking here, I just figured it's the same request, but if you feel I should create a new post instead let me know and I'll delete this and start a new thread.
Thanks!

10 years ago

@mattsoria no worries mate, it seems like your request is pretty the same.

10 years ago

You are going to need some javascript running to hook up multiple fields in multiple tabs. This is because the clicking a tab is not reloading the page, it's simply toggling visibility. So for fields to be aware of each other, javascript is going to be needed to keep those in sync as the user edits them.

That said, please make feature requests of this type here: https://github.com/getgrav/grav-plugin-admin/issues

10 years ago

Ah, I see.
In my example case though, pulling a value stored in a config tab to use in a page field, the value is stored and the page is reloaded — is it as simple as using something like:

TXT
'config.brand.primaryColor'

in a field?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1362 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2959 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago