Jump to content

How to require a core module in my module (LazyCron)?


Recommended Posts

I'm building a custom module for project that will leverage LazyCron.

I can't seem to find how you tell your module that LazyCron is required?

I've tried adding the following to my getModuleInfo()

'requires' => [
	'LazyCron'
],

and have also tried adding the following that ChatGPT suggested... but not sure if it has made up this syntax as I've not seen it before?!

'requires' => [
	'ProcessWire:LazyCron'
],

Either way I get the error:
ProcessModule: Error reported by web service: That module is not currently tracked by the modules directory

 

In an ideal world I'd just enable the core module from my own module, is this possible?

Link to comment
Share on other sites

1 hour ago, JayGee said:

In an ideal world I'd just enable the core module from my own module, is this possible?

You just need to call wire()->modules->get('LazyCron') somewhere in your module, then LazyCron will automatically be installed.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Let's have a look here in the docs:

<?php
public static function getModuleInfo() {
   return array(
       'title' => 'Hello World',
       'version' => 101,
       'author' => 'Ryan Cramer',
       'summary' => 'Just an example',
       'requires' => array("LazyCron", "AdminBar")  // added this line
       ); 
);

 

  • Like 1
Link to comment
Share on other sites

On 12/6/2024 at 12:58 PM, bernhard said:

You just need to call wire()->modules->get('LazyCron') somewhere in your module, then LazyCron will automatically be installed.

Nice thanks @bernhard - never realised it was that simple.

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...