Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error related to blueprint causes Grav / Admin to crash #3364

Closed
yankl opened this issue May 20, 2021 · 4 comments
Closed

Error related to blueprint causes Grav / Admin to crash #3364

yankl opened this issue May 20, 2021 · 4 comments

Comments

@yankl
Copy link
Contributor

yankl commented May 20, 2021

I am getting the follow error:

TypeError
Argument 1 passed to Grav\Common\Data\BlueprintSchema::processFormRecursive() must be of the type array or null, string given, called in C:\laragon\www\grav-frish\system\src\Grav\Common\Data\BlueprintSchema.php on line 320

Here is how I can reproduce this error on a relatively fresh install with Quark theme.
In quark/templates/ I add simple test.html.twig:

{% extends 'default.html.twig' %}

in user/pages/03.testbug I add test.md:

---
title: test
pick: BPY_1.1.1_Read_01.mp3
content_fallback:
    -
        key: bin
        value: BPY_1.1.1_Read_b_1.mp3
---

Finally, I add test.yaml to quark/blueprints/:

title: Oysyes Blueprint
'@extends':
    type: default
    context: blueprints://pages

form:
  fields:
    tabs:
      type: tabs
      active: 1
      
      fields:
        content:
          fields:
            header.letters:
              type: list
              label: Letters
              min: 4
              max: 4
              
              fields:
                .letter_itself:
                  type: list
                  label: Letter Audio
                  max: 2
                  
                  fields: 
                    .letter:
                      type: text
                      label: Letter
                    .file:
                      type: filepicker
                      folder: 'self@'
                      accept:
                        - .mp3
                      label: Audio
                
                .words:
                  type: list
                  label: Words
                  
                  fields:
                    .word:
                      type: text
                      label: Word
                     
                    .file:
                      type: filepicker
                      folder: 'self@'
                      accept:
                        - .mp3
                      label: Audio
                      
            .words_you_know:
              type: list
              label: Known Words
              
              fields:
                .word:
                  type: text
                  label: Word
                 
                .file:
                  type: filepicker
                  folder: 'self@'
                  accept:
                    - .mp3
                  label: Audio
            
            .words_to_read:
              type: list
              label: Words to Read
              
              fields:
                .word:
                  type: text
                  label: Word
                 
                .file:
                  type: filepicker
                  folder: 'self@'
                  accept:
                    - .mp3
                  label: Audio

Then, in .../admin/pages/testbug/mode:normal, the blueprint seems to work correctly in terms of the form created. But when I click Save, I get the mentioned error:
image

I'm sure this can be further simplified but that's what I have for now. I made an issue here instead of in Admin plugin, because the error is coming from Grav\Common\Data\BlueprintSchema and not from the Admin plugin.

Grav v1.7.15 - Admin v1.10.15

@mahagr
Copy link
Member

mahagr commented May 20, 2021

.words_you_know and .words_to_read are in top level and should have header prefix.

@yankl
Copy link
Contributor Author

yankl commented May 20, 2021

Indeed!! That fixes it. I just started learning how to compose blueprints, and missed that.
Thanks so much!

Still, I'll leave the issue open in case the developers would like to consider presenting a friendlier error message in such a case, that would help point to the problem.

@mahagr mahagr added the bug label May 21, 2021
@mahagr
Copy link
Member

mahagr commented May 21, 2021

I agree with the better error message (or just accept it) if the dot is used on the main level.

@mahagr
Copy link
Member

mahagr commented May 26, 2021

The issue here is that you have a tab named content, and .words_to_read is nested inside it. This overrides the main content with an array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants