Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Move whole section of a blueprint to another tab?

Solved by Nico Petri View solution

Started by Anna 4 years ago · 2 replies · 916 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 Anna, 2 days ago
2 53 16 hours ago
Forms & Blueprints · by Anna, 3 days ago
7 82 16 hours ago
Forms & Blueprints · by Anna, 1 week ago
5 186 6 days ago
Forms & Blueprints · by TomW, 1 month ago
3 379 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 595 2 months ago