A Simple Plugin that appears across site?
Created 7 years ago by davestar057

Ive viewed the videos - and these deal with creating whole views for steams etc.

...what I am after - which seems ridiculously hard - is to the just add a bit a of PHP logic, then use a view partial, that is then included in ALL views, in the footer for example.

There is no documentation on this as far as I can see.....can anybody be so kind as to give me some help here?!?!?

davestar057  —  7 years ago

Okay - so this is seemingly silly hard/impossibe it would seem with Pyro.

Can somebody please explain how to at least create php function and then return the value of the function to a Twig view, but creating a custom twig function to display the value....this would seem the easiest way?

brennon  —  7 years ago

Try creating a simple plugin in your theme. Then you can add whatever php code you'd like to your footer and plugins in your theme or any addon are available site wide. Check out the plugin in the users module and the service provider that enables it.

https://github.com/anomalylabs/users-module/blob/master/src/UsersModuleServiceProvider.php

https://github.com/anomalylabs/users-module/blob/master/src/UsersModulePlugin.php

You can include a plugin in your theme and then access it in your views {{ your_plugin }}