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

Move whole section of a blueprint to another tab?

Solved by Nico Petri View solution

Started by Anna 4 years ago · 2 replies · 493 views
4 years ago

Does anybody know whether there is an easy way to move a whole section in an Admin page blueprint? For example if I want the taxonomies section in the options tab to move to the content tab.

I tried ordering@ as it says in the docs but that seems to work only within the same tab. I reckon I need to unset@ the whole section under the original tab and then redeclare it where I want it – but can anyone confirm? Or maybe there is a simpler way?

4 years ago Solution

Hi @Netzhexe,

if you ment a page blueprint which is available via the admin plugin, then you can do something like this:

Create a default.yaml inside of the theme's blueprint folder and extend it using the extend@ directive as usal. Then copy the taxonomy section from the default blueprint <grav_root>/system/blueprints/pages/default.yaml. Use unset@ to disable it on the other tab.

Just for testing purposes, I copied the taxonomy to a modular-type yaml file and it works. Should work in a normal (default) page blueprint too.

YAML
title: Article
extends@:
    type: modular
    context: blueprints://pages

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

      fields:
        content:
          fields:
            content:
              unset@: true
            header.title:
              unset@: true
            header.media_order:
              unset@: true

            taxonomies:
              type: section
              title: PLUGIN_ADMIN.TAXONOMIES
              underline: true

              fields:
                header.taxonomy:
                  type: taxonomy
                  label: PLUGIN_ADMIN.TAXONOMY
                  multiple: true
                  validate:
                    type: array

            header.menuTitle:
              ordering@: -99
              type: text
              label: Menübezeichnung
              description: 'Bezeichnung, die im Menü verwendet werden soll. Wenn kein Eintrag gewünscht ist, dann leer lassen. Es werden keine Untermenüs generiert.'

Afaik the ordering@ directive only works within a fields section, so you only can order items within a specific tab.

I hope you get it work.

Best regards.

👍 1
4 years ago

Yes, it does work like that – I was just wondering whether there was an easier way. So thank you for confirming this is the way to go!

👍 1

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1138 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 62 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 136 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 130 7 months ago