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.

Plugins

Child plugin flow?

Started by Sean 7 years ago · 1 replies · 460 views
7 years ago

I have a child theme working quite nicely. I want to do the same with several plugins, modify their functionality so that upgrades don’t effect the changes. Is there an example/article on the best way to do it?

Thanks!

7 years ago

Great question! I don't know of any official way and I'm sorry I have to make a quick reply right now with some suggestions:

  • obviously you can override any templates defined in the plugin, though you are asking about functionality;
  • there may be hooks you can use. For example, the form plugin has a few, and you can use these to, for example, define custom form actions;
  • I've done this but don't have time to look it up: in your "child" plugin, extend the class defined in the plugin's PHP file and add methods, as you would extend or customise any other PHP class;
  • add Twig filters or functions using PHP that are defined in the "parent" plugin;
  • make a fork of the plugin's repo, clone that, and hack it as you like. You can modify the plugin's blueprint to make sure it fetches your fork rather than the one in the GPM repo. I do this fairly often, especially after submitting patches to the original plugin repos that don't get actioned (often stagnant or abandoned plugins).

Sorry that's a bit quick. Hope it helps.

👍 1

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 54 1 week ago
Plugins · by Xavier, 4 weeks ago
2 61 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1188 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 54 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 79 2 months ago