This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi, this is my first time seeking help here at OCMS forums. I'm working with a theme that uses plugins (e.g RainLab.Blog) in order for it to work. Is there any twig code/conditional statement if the plugin is disabled or not? It's very useful to display infos regarding the theme rather than redirecting it into an error page.
Thanks in advance.
Last updated
You should be able to do:
use System\Classes\PluginManager;
and then:
$manager = PluginManager::instance();
if ($manager->exists('rainlab.blog')) {
// Do Stuff
}
or
if ($manager->isDisabled('rainlab.blog')) {
// Do Stuff
}
Last updated
That's weird. I put the code into the header partial and it shows:
syntax error, unexpected '$manager' (T_VARIABLE), expecting function (T_FUNCTION)
and the conflict is in the $manager = PluginManager::instance();
part.
KurtJensen said:
You need to put it inside a method of a controller, component, or plugin class.
or maybe inside the dynamic page feature of page, layout or partial in
function onStart()
Last updated
1-5 of 5