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.

Archive

Data-options not in object context

Started by Muut Archive 9 years ago · 3 replies · 877 views
9 years ago

I'm attempting to create a custom content type (podcast) and then add fields from a custom plugin (biblref). In the podcast.yaml file, when I use:
'@data-options: '\Grav\Plugin\BiblerefPlugin::getBookOptions'
I get the following error:

Using $this when not in object context

In my bibleref.php file, I'm attempting the following:
public function getBookOptions() {
...
$book_list = __DIR__ . '/' . $this->config->get('plugins.bibleref.book_list');

How do I reference the configuration yaml properly?

Thanks in advance

9 years ago

I was originally putting the new field definition in my theme, but moving it out to the bibleref blueprints still produced the same error.

9 years ago

The getBookOptions() method needs to be static, and as such you can't use $this, you would have to use $static.

9 years ago

Thanks for the reply. I ended up moving my file to the DATA_DIR ahead of time and referenced it there.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1280 9 years ago
Archive · by Muut Archive, 9 years ago
2 888 9 years ago
Archive · by Muut Archive, 9 years ago
2 4017 9 years ago
Archive · by Muut Archive, 9 years ago
1 2892 9 years ago
Archive · by Muut Archive, 9 years ago
3 1077 9 years ago