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 →

Data-options not in object context

Started by Muut Archive 9 years ago · 3 replies · 1278 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 Muut Archive, 10 years ago
1 671 1 week ago
Archive · by Deleted User, 9 years ago
0 3041 9 years ago
Archive · by Muut Archive, 9 years ago
2 1980 9 years ago
Archive · by Muut Archive, 9 years ago
2 5335 9 years ago
Archive · by Muut Archive, 9 years ago
1 4133 9 years ago