Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display all options in the template #29

Open
Jorckx opened this issue Jun 15, 2023 · 1 comment
Open

display all options in the template #29

Jorckx opened this issue Jun 15, 2023 · 1 comment

Comments

@Jorckx
Copy link

Jorckx commented Jun 15, 2023

Hi! to start, great plugin!
I'm just wondering how to output all options (not the selected one) to a template. I want to create a sample-page for my client who uses different page-colour-options.

@MichaelvanLaar
Copy link

Same here. I would like to create custom CSS properties in the head section of the page from all values of a central brand-color field blueprint. This way I could let editors choose brand colors in the panel when needed (e.g. for info box backgrounds), and at the same time have all brand colors available for CSS rules – while only having one central place for defining brand colors to keep everything DRY.

I tried to apply the info from https://getkirby.com/docs/cookbook/templating/fetching-field-options to the following (demo) field setup:

type: color-palette
label:
  en: Brand Colors
  de: Markenfarben
options:
  red:
    lightMode: "#fecaca"
    darkMode: "#991b1b"
    contrastLightMode: "#000000"
    contrastDarkMode: "#ffffff"
  black:
    lightMode: "#000000"
    darkMode: "#ffffff"
    contrastLightMode: "#ffffff"
    contrastDarkMode: "#000000"
  white:
    lightMode: "#ffffff"
    darkMode: "#000000"
    contrastLightMode: "#000000"
    contrastDarkMode: "#ffffff"
display: duo
unselect: true

But I only get the error message Undefined array key "lightMode", even if I just try to var_dumpall info from the optionsof the field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants