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

blueprints - import@ always on top #1844

Open
KennethJoris opened this issue Jan 28, 2018 · 15 comments
Open

blueprints - import@ always on top #1844

KennethJoris opened this issue Jan 28, 2018 · 15 comments
Assignees
Labels

Comments

@KennethJoris
Copy link

KennethJoris commented Jan 28, 2018

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?

@rhukster
Copy link
Member

rhukster commented Feb 3, 2018

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.

@rhukster
Copy link
Member

rhukster commented Feb 3, 2018

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

@mahagr
Copy link
Member

mahagr commented Feb 5, 2018

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

@mahagr
Copy link
Member

mahagr commented Mar 9, 2018

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...

@mahagr
Copy link
Member

mahagr commented Mar 9, 2018

See rockettheme/toolbox#17

@mahagr
Copy link
Member

mahagr commented Mar 9, 2018

Your issue is in rockettheme/toolbox#18

@sebastianbaumann
Copy link

sebastianbaumann commented Jun 1, 2018

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

@mahagr
Copy link
Member

mahagr commented Jun 12, 2018

@sebastianbaumann Use

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

@LoveYouFyi
Copy link

@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.

@mahagr
Copy link
Member

mahagr commented Jun 13, 2018

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.

@LoveYouFyi
Copy link

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

@NicoHood
Copy link
Contributor

NicoHood commented Nov 19, 2020

This works for me in grav 1.6.28, I guess the issue can be closed now. (it should be documented though, see getgrav/grav-learn#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.

@mahagr
Copy link
Member

mahagr commented Nov 24, 2020

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

@NicoHood
Copy link
Contributor

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.

@mahagr
Copy link
Member

mahagr commented Dec 1, 2020

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.

mahagr pushed a commit to getgrav/grav-learn that referenced this issue Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants