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

I need help with modular pages and custom blueprints

Solved by Fabien View solution

Started by Parrick 6 years ago · 9 replies · 592 views
6 years ago

I have a blue print at the following location:
user/themes/klar/blueprints/modular/about-us-me.de.yml

And the page is here:
user/pages/03.home/_ueber-uns/about-us-me.de.md

Template here:
user/themes/klar/templates/modular/about-us-me.html.twig

Content of blueprint:

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

      fields:
        gallery:
          type: tab
          title: Gallery
          fields:
            header.an_example_text_field:
              type: text
              label: Add a number
              default: 5
              validate:
                required: true
                type: int

Content of page:

YAML
    ---
    title: 'Über uns'
    media_order: agentur.jpg
    test: test
    ---
    # Webagentur

The tab is not showing up, i cleared also the cache.
Is the langauge code the issue?

Thank you so much for your help!

last edited 07/08/20 by pamtbaau
6 years ago

Shouldn’t it be blueprints/modular/about-us-me.yml?

6 years ago

@patrick20, Welcome to the forum. Hope you will be going to enjoy Grav!

There are a few issues with the setup.

  • You are not using the default English language, but German. Therefor you will have to define the supported languages in '/user/config/system.yaml'
    YAML
    languages:
    supported: [de]   # Add others if needed
    
  • Blueprints do not use the language ('de') as extension. All language use the same page blueprint. Only the content of the blueprint is translated.

    YAML
    fields:
    gallery:
      type: tab
      title: THEME_KLAR.GALLERY   // this will be translated
    

    With the following in '/user/config/themes/klar/languages.yaml':

    YAML
    en:
    THEME_KLAR:
      GALLERY: Gallery
    
    de:
    THEME_KLAR:
      GALLERY: Galerie
    
  • You will probably want to extend the default configuration in your page blueprint for 'about-us-me.yaml'. You should therefor tell Grav that it extends the default page:
    TXT
    title: Gallery
    '@extends': default
    
👍 1
last edited 07/08/20 by pamtbaau
6 years ago

Thanks for your answer!
This has no effect, still don't see the tab.

6 years ago

Sorry, try to remove the modular/ as well: blueprints/about-us-me.yml

6 years ago

Thanks for your answer!

This alone wasn't enough to solve this issue.

This is the system config regarding the languages:

YAML
languages:
  supported:
    - de
  default_lang: de
  include_default_lang: true
  pages_fallback_only: false
  translations: true
  translations_fallback: true
  session_store_active: false
  http_accept_language: true
  override_locale: true 

default has be a blueprint?

last edited 07/08/20 by Parrick
6 years ago Solution

Try changing the extension from yml to yaml. ;)

Worked for me.

👍 2
6 years ago

@patrick20, The blueprint 'default' to extend from is already defined by Grav in '/system/blueprints/pages/default.yaml'

The suggestion from @arkhi to replace 'yml' with 'yaml' does indeed make a difference...

It seems you are not the first to stumble on it. Here is an issue on the repo about Load .yml files as well as .yaml

👍 2
last edited 07/08/20 by pamtbaau
6 years ago

@arkhi
@pamtbaau

Thank you so much! The issue was indeed the yaml/yml and the language code.
The blueprint has to be in user/themes/klar/blueprints/modular/<blueprint>

Have a good day!

👍 1

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1140 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 63 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 138 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 114 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 132 7 months ago