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

Plugins fetch their config & templates ONLY from their own dir

Started by Muut Archive 11 years ago · 2 replies · 360 views
11 years ago

Hi all,

when changing some (any) plugin settings in their *.yaml file we are advised to copy these config files to /user/plugins to avoid them becoming changed when the plugin is updated.

However, (in my case) these copies are ignored. Settings are effective only when I change the YAML within the plugin folder itself.

Same is true for plugin templates (*html.twig). Say, I want to change the simplesearch searchbox. Changes are only recognized when I do the them in /plugins/simplesearch/templates/partials/simplesearch_searchbox.html.t wig - NOT in the respective /user/themes subfolder.

Can't figure out why. Any suggestions?

Using Grav v1.0.0-rc.3 with customized TWENTY FIFTEEN theme.

Thanks in advance!

11 years ago

The advice about the user configurations is sound.

To know what and where config things are set, look in the cached config object that represents all configuration as big array in cache/compiled/config/master-localhost.php (or whatever it's called for you)

This will tell you what Grav has merged to get the final definitive configuration state. If your files are not picked up, then chances are it's a naming issue.

For example, if you have a plugin simplesearch, then you need to copy the simplesearch.yaml from the plugin to user/config/plugins/simplesearch.yaml

This does work, as every Grav site would not function without it!

Templates work differently, they rely on Twig's template loader to provide overrides. Basically a theme such as simplesearch adds it's own folder location to the Twig loader, so that templates like partials/simplesearch_searchbox.html.twig are provided at least by the plugin. However if you copy this file, and put it in: user/themes/yourtheme/templates/partials/ that file will be used over the plugin's version.

hope that helps!

11 years ago

Thank you, it helped! I made a mistake all the time. Instead of copying the altered config to user/config/plugins/, I, for some reason, put it into /user/plugins (parent of the plugin itself). Got lost between all those dashes.

Thanks again!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1346 9 years ago
Archive · by Muut Archive, 9 years ago
2 933 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2945 9 years ago
Archive · by Muut Archive, 9 years ago
3 1117 9 years ago