Blueprint: Error on save

Hello,

I’m working on a page blueprint.
In the admin panel, I have the result I want and it shows the information from the markdown page.
Therefore, when I try to save the page in the admin panel, I have this error:

> Argument 1 passed to Grav\Common\Page\Page::move() must be an instance of Grav\Common\Page\Page, null given, called in C:\wamp\www\charitybackpackers\user\plugins\admin\classes\admincontroller.php on line 498 and defined

I know that it comes from the blueprint, but I can’t find the mistake.

Here is the markdown file of the desired output:

googlemaps:
    map:
        center: 51.009314, 4.061254
        zoom: 12
        markers:
            - location: 51.009358, 4.061578
              title: Title of the 1st marker
              zIndex: 1
              timeout: 1000
              info: Description of the 1st marker
            - location: 51.017227, 4.073198
              title: Title of the 2nd marker
              zIndex: 2
              timeout: 2000

Here is the blueprint I wrote:

title: Marker
form:
  fields:
    tabs:
      type: tabs
      active: 1
      fields:
        tab:
          type: tab
          title: Google maps
          fields:
            header.googlemaps:
              type: fieldset
              title: "Options of the map:"
              fields:
                header.googlemaps.map.center:
                  type: text
                  label: "Center:"
                header.googlemaps.map.zoom:
                  type: text
                  label: "Zoom:"
            header.googlemaps.map.markers:
              type: list
              btnLabel: Add one marker
              label: "Your markers:"
              fields:
                .title:
                  label: Title
                  type: text
                .info:
                  label: Description
                  type: text
                .location:
                  label: Location
                  type: text
                .zIndex:
                  label: zIndex
                  type: text
                .icon:
                  label: Icon
                  type: text
                .timeout:
                  label: Timeout
                  type: text

And here is a screenshot of the admin panel:

As you can see, it reads the pre-existing info in the markdonw file, but if I save, i get the error.

If anyone could help me with this.
Thank you in advance ! :slight_smile:

You need to extend from the default page blueprint, because some fields are mandatory for a correct handling, in this case the folder field is missing.

You can remove some fields, like the default content tab, but more general-usage page options should be kept.

This will fix the problem at hand. We should have a more meaningful message.

1 Like

Amazing, it works now.

Sure, a more meaninfgul message would be nice.
It could also be nice to add to this page, “Create a completely custom page form”, that some fields are mandatory.

But anyway, thank you so much ! :smile:

I’ve also bumped into this issue while creating blueprints. Is it possible to put together a list of those mandatory fields? Otherwise is this whole “create a completely custom blueprint” and also unsetting some fields in an extended blueprint quite dangerous :smiley:
Thanks.

A similar issue has been raised in https://github.com/getgrav/grav-plugin-admin/issues/1163 too, as we had a regression in admin@1.5.0, now fixed in admin@1.5.1.

Basically you need at least the route parameter, like in this example. It can even be hidden, if you want.

1 Like