Jump to content

How to check if a module is installed?


arjen
 Share

Recommended Posts

I've made a simple module called MarkupBox which is not installed in the CMS, but the files are in the module directory (/site/modules/). When I call the module from a template it returns the value. I suppose there is a way to check if a module is installed, but I can't find it in the code or in the forums. I'm looking for someting like:

if ($modules->get("MarkupBox")->isInstalled())
{
    // Do something
}

Module:

public function render()
{
    $out = "Test";
    return $out;
}

Template:

$box = $modules->get("MarkupBox");
echo $box->render();

Thanks!

  • Like 1
Link to comment
Share on other sites

Thanks soma for the info. I ran into some issues but realised the module installed itself. My new code:

if ($modules->isInstalled("MarkupBox")) {
    echo $modules->get("MarkupBox")->render();
}
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...