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

blueprint in theme's blueprints/flex-objects folder not loaded #3255

Closed
phmg701 opened this issue Mar 4, 2021 · 15 comments
Closed

blueprint in theme's blueprints/flex-objects folder not loaded #3255

phmg701 opened this issue Mar 4, 2021 · 15 comments
Assignees

Comments

@phmg701
Copy link
Contributor

phmg701 commented Mar 4, 2021

Hello,

here's the case:

  • blueprint my_objects.yaml placed in user/blueprints/flex-objects is correctly loaded.
  • blueprint my_objects.yaml placed in themes/my_theme/blueprints/flex-objects is not loaded.

Maybe it's not a bug per se, but if I correctly understand the path to 2.0, letting flex-objects blueprints to be loaded alongside other theme blueprints would be very useful.

Edit: Grav + Plugins are up-to-date as of today.

Thank you!

@mahagr
Copy link
Member

mahagr commented Mar 4, 2021

Themes do not have the same folder structure for blueprints (for legacy reasons themes contain only page blueprints), which likely is the reason why it doesn't work.

@mahagr mahagr self-assigned this Mar 4, 2021
@phmg701
Copy link
Contributor Author

phmg701 commented Mar 4, 2021

Thank you for the prompt reply! I suspected this couldn't be actually a bug 😄
It would be great to have such feature in a near-future release, paving the way to 2.0 theme blueprint management.
It would also be great to have multilanguage support for Flex Objects, but that's another story 👀
Thank you!

@mahagr mahagr added the fixed label Mar 11, 2021
@mahagr
Copy link
Member

mahagr commented Mar 11, 2021

Should be now implemented and will be released soon.

In order to enable the support, you need to set minimum requirement in the blueprints:

dependencies:
  - { name: grav, version: '>=1.7.8' }

And move all the files from user/themes/theme/blueprints/ folder into user/themes/theme/blueprints/pages/.

@rhukster
Copy link
Member

released

@phmg701
Copy link
Contributor Author

phmg701 commented Mar 18, 2021

Hello, thank you very much @mahagr, just updated everything to yesterday's release but I am sorry to report that blueprint photos.yaml doesn't load from location user\themes\{THEME}\blueprints\pages\.

title: Photos
description: Simple Photo directory with Categories and Tags.
type: flex-objects
dependencies:
  - { name: grav, version: '>=1.7.8' }

the same loads perfectly from user\blueprints\flex-objects\

Shall I do some other tests? Change something else? Delete some config files?
I am fascinated by Grav's approach to content management, and willing to understand it, but it's a steep learning curve!

Thank you!

@mahagr
Copy link
Member

mahagr commented Mar 18, 2021

Umm, that is not a page blueprint. I tried to say that you need to move every existing blueprint file in the theme from blueprints/ to blueprints/pages/, otherwise it is using a wrong directory structure and it only supports page blueprints.

Also the dependencies section needs to be in the theme blueprint (blueprints.yaml), not in the flex object blueprint.

@phmg701
Copy link
Contributor Author

phmg701 commented Mar 18, 2021

Roger that!

I did as suggested, updated dependencies in theme's blueprints.yaml but unfortunately flex-objects type blueprint is not loaded.
2021-03-18_Grav_01
2021-03-18_Grav_02

I am a beginner, so thank you for your patience.

Once I get this to work, I am willing to propose changes in Learn so others can take advantage of this.

Thank you!

@mahagr
Copy link
Member

mahagr commented Mar 18, 2021

Now you need to move the flex blueprint out of the pages folder to where it is supposed to be :) My instruction was just for the existing stuff before adding the new blueprints :)

@phmg701
Copy link
Contributor Author

phmg701 commented Mar 18, 2021

2021-03-18_Grav_03

Like this, correct? It doesn't get loaded, but I am sure I am missing something! Thanks!!!

@mahagr
Copy link
Member

mahagr commented Mar 19, 2021

Umm, blueprints should have no files, everything needs to be in specific folders under it.

  • config: themes/my_theme/blueprints/config
  • flex: themes/my_theme/blueprints/flex-objects
  • pages: themes/my_theme/blueprints/pages

@phmg701
Copy link
Contributor Author

phmg701 commented Mar 19, 2021

2021-03-19_Grav_01

Thanks now it's even clearer! Even doing so, blueprint is not loaded.

Thank you!

@phmg701
Copy link
Contributor Author

phmg701 commented Mar 20, 2021

I tried the following:

  • Grav 1.7.9 + Admin - fresh local install (MacOS 10.15.7 - PHP 7.3.27)
  • creation of the first user account
  • moved Quark theme files into pages
  • created folder flex-objects and copied photos.yaml there
  • edited Quark theme blueprints.yaml with
dependencies:
  - { name: grav, version: '>=1.7.8' }

Photos appears in Flex Objects Plugin list, so I enabled it:
2021-03-20_Grav_01
yet it doesn't appear on the left.
photos.yaml.txt
here's the blueprint, maybe the problem is there.

Again, thank you!

@phmg701
Copy link
Contributor Author

phmg701 commented Mar 20, 2021

OK, there's definitely something going on @mahagr .
Default contacts, when moved to /user/themes/quark/blueprints/flex-objects/ is listed in Flex Objects Plugin but doesn't get loaded either.
Maybe this issue still needs to be open?
Thank you!

@mahagr
Copy link
Member

mahagr commented Mar 31, 2021

Should be fixed now.

@LiaraAlis
Copy link

From version 1.7.41 flex-object blueprints are not loaded in the frontend (admin works). See also trilbymedia/grav-plugin-flex-objects#177. Has anyone else had such experiences?

After a long research it seems that the path to the theme blueprint directory is only added to the locator if the flex object plugin has already tried to add the directory to the flex object for the respective type. However, since it cannot find the blueprint, the listing in the frontend with custom blueprint types does not work. Asking the locator about the blueprint path after theme initialization is finished, produces a positive result - but it is to late for the flex object when using Flex::getDirectory().

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

4 participants