Grav: blueprints - import@ always on top

Created on 28 Jan 2018  路  15Comments  路  Source: getgrav/grav

When Embedding Form (@import), the imported fields always go on top, above the default fields. Using ordering@ has no effect.

(SEE SCREENSHOT - i'm using the tinyMCE editor plugin)
schermafbeelding 2018-01-28 om 22 06 05

The parent file:
schermafbeelding 2018-01-28 om 22 17 52

the fields to import:
schermafbeelding 2018-01-28 om 22 16 43

How do you keep the default fields on top?
The documentation states:

When you extend a blueprint or import a file, by default the new fields are added to the end of the list.

But this seems not to be the case?

What am i doing wrong here?

bug

All 15 comments

This is currently a limitation of the import@ feature. I've run into this myself, and currently, there is not work around to fix it.

@mahagr do you have any thoughts on how to address this?

Custom ordering should work if the blueprint is properly initialized. Will need to investigate this.

You're right, the current logic doesn't allow you to append the blueprints where you want them to be.

I've been working on adding support for multiple imports in the same level:

import@1: fields/hero
import@2: fields/footer

I've also added support for partial imports:

# Same as without specifying partial import:
import@: fields/hero:form
# Imports hero section separator:
import@: fields/hero:form/fields/hero
# Imports fields outside of the main form:
import@: fields/footer:test/fields
# Imports also work from the current file:
import@: :include/fields

I'm still trying to figure out how to fix the ordering, so nothing is committed yet...

Any news on the multiple import feature? I've just stumbled accross this, when I tried to import multiple partials into one blueprint file.

          fields:
            import@: partials/cta
            import@: partials/fileupload

@sebastianbaumann Use

          fields:
            import@1: partials/cta
            import@2: partials/fileupload

@mahagr can you confirm using import@1 ... import@2 is a very recent addition as I tried that a few weeks ago and it was not working.

Looks like this feature isn't yet in the released rockettheme/toolbox package. You can try it by changing composer.json file and running composer update --no-dev (you may need to install composer first, google it):

        "rockettheme/toolbox": "dev-develop",

Find the line and replace the value before running the command.

Thank you, I can work with composer but may wait until it's in grav core.

This works for me in grav 1.6.28, I guess the issue can be closed now. (it should be documented though, see https://github.com/getgrav/grav-learn/pull/855)

Edit: It seems to ignore the number. I dont know why I thought it worked before, maybe I did not check carefully enough? At least this feature would be very helpful!

So what happens is that both templates get included, but not ordered properly.

Number is there just do make the key to differ, allowing multiple instances of the same command.

So sorting is not possible at all? :-(

I think the issue can be closed then, as it works as expected. Is implementing a sorting function an option to you? We could track it in another issue.

Yeah... Unfortunately the blueprints do not handle importing other documents too well. However, if you define the structure in the main template, you will be able to dictate the ordering of the main elements.

Was this page helpful?
0 / 5 - 0 ratings