Added a new date format

Because the administration panel overwrites my date format in the site.yaml file according to the instructions from this thread:

I added the file:
user/blueprints/config/site.yaml

about content:

'@extends': '@parent'
form:
  fields:
    content:
      fields:
        pages.dateformat.short:
          options:
            'd-m-Y G:i': Date6

The file goes through:
bin/grav yamllinter
without errors.

Unfortunately, I still don’t have my date format options available in the panel.

1 Like

Hmm, yeah you’re in an annoying YAML tangle. I really dislike this kind of nested YAML. So I’m wondering if you should establish a few basic extensions first to test your nesting.

Could you try (or have you tried) the simpler site.yaml examples in the docs and do they work? Can you merge your changes incrementally into those to see if your nesting is accurate?

There is hope for humanity. Chat gpt can’t help with that either :wink:

Following your advice, I tried the simple versions from the documentation.

I created two files:
user/bluprints/config/system.yaml,
user/bluprints/config/site.yaml.

The first of these examples does not work for any of the tabs.

Second example:

'@extends': '@parent'
form:
  fields:
    anothersection:
      type: section
      title: Another Section
      underline: true

      fields:
        myfield:
          type: text
          label: A label
          size: large

works and adds a new section at the bottom of each tab.

However, I still don’t know how to add any text field within the section and how to finally add an item in the select short date format field.

1 Like

I managed to solve it.

  1. I copied the file:
    system/blueprints/config/system.yaml
    to
    user/blueprints/config/system.yaml.

  2. I removed everything from the file that seemed unnecessary to me and left:

'@extends': '@parent'

form:
  fields:
    system_tabs:
      fields:
        content:
          fields:
            pages.dateformat.short:
              options:
                'd-m-Y G:i': Date6

A new option appears in the selection list.

2 Likes