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.

General

Added a new date format

admin blueprints

Solved by Norbert View solution

Started by Norbert 2 years ago · 3 replies · 471 views
2 years ago

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

/forum/general/date-format-for-short-and-long-ignored-t9030

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

about content:

YAML
'@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
2 years ago

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?

2 years ago

There is hope for humanity. Chat gpt can't help with that either ;)

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:

YAML
'@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
2 years ago Solution

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:

YAML
'@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

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 3 days ago
2 70 5 hours ago
General · by pamtbaau, 10 hours ago
1 45 9 hours ago
General · by Andy Miller, 22 hours ago
0 43 22 hours ago
General · by Marcel, 12 months ago
6 341 4 days ago
General · by Duc , 5 days ago
3 35 5 days ago