getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.41k stars 1.39k forks source link

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

Closed phmg701 closed 3 years ago

phmg701 commented 3 years ago

Hello,

here's the case:

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 commented 3 years ago

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.

phmg701 commented 3 years ago

Thank you for the prompt reply! I suspected this couldn't be actually a bug :smile: 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 :eyes: Thank you!

mahagr commented 3 years ago

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 commented 3 years ago

released

phmg701 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago
2021-03-18_Grav_03

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

mahagr commented 3 years ago

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

phmg701 commented 3 years ago

2021-03-19_Grav_01

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

Thank you!

phmg701 commented 3 years ago

I tried the following:

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 commented 3 years ago

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 commented 3 years ago

Should be fixed now.

LiaraAlis commented 6 months ago

From version 1.7.41 flex-object blueprints are not loaded in the frontend (admin works). See also https://github.com/trilbymedia/grav-plugin-flex-objects/issues/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().