Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Flex Objects blueprints in theme or plugin

Solved by beejay41 View solution

Started by beejay41 6 years ago · 1 replies · 959 views
6 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

6 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 Anna, 4 days ago
1 93 4 days ago
Support · by Anna, 3 weeks ago
1 265 3 weeks ago
Support · by webmasterodp, 1 month ago
4 380 1 month ago
Support · by nwhitfield, 1 month ago
2 351 1 month ago
Support · by stell, 2 months ago
5 657 1 month ago