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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Flex Objects blueprints in theme or plugin

Solved by beejay41 View solution

Started by beejay41 5 years ago · 1 replies · 596 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 Thomas, 1 week ago
2 57 14 hours ago
Support · by Anna, 3 days ago
2 65 17 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago