Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
class MyModule extends Module {
...
	public function getName() {
		return Language::_("MyModule.name", true);
	}
...
}

...

getVersion()

The getDescription() method simply returns the description This method must return the current version number of the module. It was added in Blesta v4.9.0. It's always best to define any language in your module using language files (see Translating Blesta for more information)Upon installation or upgrade, Blesta records the current code version so that it can tell when an upgrade/downgrade is available. The version number should be compatible with PHP's version_compare() function.

Code Block
languagephp
class MyModule extends Module {
	const VERSION = "1.0.0";	
...
	public function getDescriptiongetVersion() {
		return Languageself::_("MyModule.description", true);
	}
...VERSION;
	}
...

}

...

getAuthors()

This method must return the current version number of the module. Upon installation or upgrade, Blesta records the current code version so that it can tell when an upgrade/downgrade is available. The version number should be compatible with PHP's version_compare() functionreturns an array containing information about the authors of the module.

Code Block
languagephp
class MyModule extends Module {
	const VERSION = "1.0.0";	
...
	public function getVersion() {
		return self::VERSION;
	}
...

}

getAuthors()

This method returns an array containing information about the authors of the module.

Code Block
languagephp
class MyModule extends Module {
    private static $authors = array(array('name' =>     private static $authors = array(array('name' => "Phillips Data, Inc.", 'url' =>"http://www.blesta.com"));
...
	public function getAuthors() {
		return self::$authors;
	}
...
}

...

Info
titleCreate your cron tasks first

You must create your cron tasks during an install() or upgrade() in order for them to exist in Blesta and be run automatically. See install/upgrade/uninstall above for an example) in order for them to exist in Blesta and be run automatically. See install/upgrade/uninstall above for an example.


Code Block
languagephp
class MyModule extends Module {
...
	public function cron($key) {
		switch ($key) {
			case "task_one":
				// Perform any action the module should do based on the cron task
				break;
		}
	}
...
}

getDescription()

The getDescription() method simply returns the description of the module. It was added in Blesta v4.9.0. It's always best to define any language in your module using language files (see Translating Blesta for more information).

Code Block
languagephp
class MyModule extends Module {
...
	public function crongetDescription($key) {
		switchreturn ($key) {
			case "task_one":
				// Perform any action the module should do based on the cron task
				break;
		}Language::_("MyModule.description", true);
	}
...
}

getLogo()

The getLogo() method returns the relative path (within the module's directory) to the logo used to represent the module. The default value is views/default/images/logo.png. This translates to /install_dir/components/modules/my_module/views/default/images/logo.png

...