Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Flex Objects blueprints in theme or plugin

Solved by beejay41 View solution

Started by beejay41 5 years ago · 1 replies · 666 views
5 years ago

As the main deliverable for a website, the theme is an ideal place to install new Flex Object blueprints. However, just adding blueprints/flex-objects/newobject.yaml doesn't appear to be enough to register the new object type.

The Flex Object README refers to onFlexInit, however the source code states // This event is for backwards compatibility only, do not use it!.

So what is the correct way to register Flex Object blueprints in a theme or plugin? Is there an example somewhere that I've missed?

Regards BJ

5 years ago Solution

I was beginning to think that this a was a stupid question.

The solution turns out to be simple. A new flex object can be added to a basic plugin by adding blueprints/flex-objects/newobject.yaml as I though, but the plugin needs the following, before the blueprint is discovered:

PHP
    public $features = [
    'blueprints' => 100,
];

I've seen this code in other plugins, but not found it mentioned in the documentation.
I doesn't appear this trick works in a template.

Suggested topics

Topic Participants Replies Views Activity
Support · by BenLaKnet, 5 days ago
1 123 2 days ago
Support · by BenLaKnet, 1 week ago
5 195 2 days ago
Support · by kskt, 3 days ago
0 45 3 days ago
Support · by David Meissner, 3 days ago
0 44 3 days ago
Support · by David Meissner, 4 days ago
3 92 3 days ago