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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Trying to set advanced / overrides / visible to DISABLED by default in my page blueprint

Started by Matthew Appleton 8 years ago · 5 replies · 847 views
8 years ago

I have a projectpage.yaml file, extending 'default' — and I want to force new project pages to be set to visible 'disabled' by default when adding new pages with projectpage template...

trying with this structure, but no dice...

YAML
form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        advanced:
          fields:
            overrides:
              fields:
                header.visible:
                  default: false  

                header.debugger:
                  default: false
last edited 04/06/18 by Matthew Appleton
8 years ago

You might have to set default to 1 or to redefine the whole field, so something like this should work:

YAML
title: MyTitle
'@extends':
    type: default
    context: blueprints://pages

form:
  fields:
    tabs:
      fields:
        advanced:
          fields:
            overrides:
              fields:
                header.visible:
                  type: toggle
                  toggleable: true
                  label: PLUGIN_ADMIN.VISIBLE
                  help: PLUGIN_ADMIN.VISIBLE_HELP
                  highlight: 1
                  default: 0
                  options:
                    1: PLUGIN_ADMIN.ENABLED
                    0: PLUGIN_ADMIN.DISABLED
                  validate:
                    type: bool
8 years ago

This yaml is hard to read for me, because of these inconvenient indentation

8 years ago

09|690x57

hi @paul - -thanks as ever - -so far it gives me this craziness! Having a tinker now...

8 years ago

Still stumped!

This is my current .yaml... the custom.Subtitle and the folder.numeric prefix are working fine, but not visibility 'off' setting....

Out of interest, where is the documentation that would tell me how to define / find labels like this label: PLUGIN_ADMIN.VISIBLE

//

YAML
title: projectpage
@extends: 
  type: default
  context: blueprints://pages

form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        content:
          type: tab

          #
          # Add your custom fields here.
          # These fields will be available in the page's Content tab
          # inside the Admin Panel.
          #
          fields:

            #
            # subtitle text field
            #
            header.custom.Subtitle:
              type: text
              label: Subtitle          

form: 
  fields: 
    tabs: 
      fields: 
        advanced: 
          fields: 
            overrides: 
              fields: 
                header.visible:
                  type: toggle
                  label: PLUGIN_ADMIN.VISIBLE  
                  help: PLUGIN_ADMIN.VISIBLE_HELP
                  highlight: 1
                  default: 1
                  options: 
                    1: PLUGIN_ADMIN.DISABLED
                    0: PLUGIN_ADMIN.ENABLED
                  validate: 
                    type: bool                                
form:
  fields:
    tabs:
      fields:
        advanced:
          fields:
            columns:
              fields:
                column2:
                  fields:
                    ordering:
                      type: toggle
                      label: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX
                      help: PLUGIN_ADMIN.FOLDER_NUMERIC_PREFIX_HELP
                      highlight: 1
                      default: 1
                      options:
                        1: PLUGIN_ADMIN.ENABLED
                        0: PLUGIN_ADMIN.DISABLED
                      validate:
                        type: bool
last edited 04/06/18 by Matthew Appleton

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1136 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 134 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 129 7 months ago