Class humhub\components\Module

Inheritancehumhub\components\Module » yii\base\Module
Subclasseshumhub\modules\activity\Module, humhub\modules\admin\Module, humhub\modules\comment\Module, humhub\modules\content\Module, humhub\modules\content\components\ContentContainerModule, humhub\modules\dashboard\Module, humhub\modules\directory\Module, humhub\modules\file\Module, humhub\modules\friendship\Module, humhub\modules\installer\Module, humhub\modules\ldap\Module, humhub\modules\like\Module, humhub\modules\live\Module, humhub\modules\marketplace\Module, humhub\modules\notification\Module, humhub\modules\post\Module, humhub\modules\queue\Module, humhub\modules\search\Module, humhub\modules\space\Module, humhub\modules\space\modules\manage\Module, humhub\modules\stream\Module, humhub\modules\topic\Module, humhub\modules\tour\Module, humhub\modules\ui\Module, humhub\modules\user\Module, humhub\modules\web\Module

Base Class for Modules / Extensions

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$resourcesPath string The path for module resources (images, javascripts) Also module related assets like README. humhub\components\Module

Public Methods

Hide inherited methods

MethodDescriptionDefined By
disable() Disables a module humhub\components\Module
enable() Enables this module humhub\components\Module
getActivityClasses() Returns a list of activity class names this modules provides. humhub\components\Module
getAssetClasses() Returns a list of asset class names this modules provides. humhub\components\Module
getAssetPath() humhub\components\Module
getAssetsUrl() Get Assets Url humhub\components\Module
getConfigUrl() URL to the module's configuration action humhub\components\Module
getDescription() Returns modules description provided by module.json file humhub\components\Module
getImage() Returns image url for this module Place your modules image in /module_image.png humhub\components\Module
getName() Returns modules name provided by module.json file humhub\components\Module
getNotifications() Returns a list of notification classes this module provides. humhub\components\Module
getPermissions() Returns a list of permission objects this module provides. humhub\components\Module
getPublishedUrl() Returns the url of an asset file and publishes all module assets if the file is not published yet. humhub\components\Module
getVersion() Returns modules version number provided by module.json file humhub\components\Module
hasNotifications() Determines whether the module has notification classes or not humhub\components\Module
init() humhub\components\Module
isPublished() Checks if a specific asset file has already been published humhub\components\Module
migrate() Execute all not applied module migrations humhub\components\Module
publishAssets() Publishes the basePath/resourcesPath (assets) module directory if existing. humhub\components\Module
update() This method is called after an update is performed. humhub\components\Module

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getModuleInfo() Reads module.json which contains basic module information and returns it as array humhub\components\Module

Property Details

$resourcesPath public property

The path for module resources (images, javascripts) Also module related assets like README.md and module_image.png should be placed here.

public string $resourcesPath 'assets'

Method Details

disable() public method

Disables a module

This should delete all data created by this module. When override this method make sure to invoke call parent::disable() AFTER your implementation as

public function disable()
{
    // custom disable logic
    parent::disable();
}
public void disable ( )
enable() public method

Enables this module

public boolean enable ( )
getActivityClasses() public method (available since version 1.2)

Returns a list of activity class names this modules provides.

public array getActivityClasses ( )
return array

List of activity class names

getAssetClasses() public method (available since version 1.2.8)

Returns a list of asset class names this modules provides.

public array getAssetClasses ( )
return array

List of asset class names

getAssetPath() public method

public void getAssetPath ( )
getAssetsUrl() public method

Get Assets Url

public string getAssetsUrl ( )
return string

Image Url

getConfigUrl() public method

URL to the module's configuration action

public string getConfigUrl ( )
return string

The configuration url

getDescription() public method

Returns modules description provided by module.json file

public string getDescription ( )
return string

Description

getImage() public method

Returns image url for this module Place your modules image in /module_image.png

public String getImage ( )
return String

Image Url

getModuleInfo() protected method

Reads module.json which contains basic module information and returns it as array

protected array getModuleInfo ( )
return array

Module.json content

getName() public method

Returns modules name provided by module.json file

public string getName ( )
return string

Name

getNotifications() public method (available since version 1.1)

Returns a list of notification classes this module provides.

public array getNotifications ( )
return array

List of notification classes

getPermissions() public method (available since version 0.21)

Returns a list of permission objects this module provides.

If a content container is provided, the method should only return applicable permissions for the given container. This function should also make sure the module is installed on the given container in case the permission only affects installed features.

public array getPermissions ( $contentContainer null )
$contentContainer humhub\modules\content\components\ContentContainerActiveRecord

Optional contentcontainer

return array

List of permissions

getPublishedUrl() public method

Returns the url of an asset file and publishes all module assets if the file is not published yet.

public string getPublishedUrl ( $relativePath )
$relativePath string

Relative file path e.g. /module_image.jpg

getVersion() public method

Returns modules version number provided by module.json file

public string getVersion ( )
return string

Version Number

hasNotifications() public method (available since version 1.2)

Determines whether the module has notification classes or not

public boolean hasNotifications ( )
return boolean

Has notifications

init() public method

public void init ( )
isPublished() public method

Checks if a specific asset file has already been published

public string isPublished ( $relativePath )
$relativePath string
migrate() public method

Execute all not applied module migrations

public void migrate ( )
publishAssets() public method

Publishes the basePath/resourcesPath (assets) module directory if existing.

public array publishAssets ( $all false )
$all boolean

Whether or not to publish sub assets within the assets directory

update() public method

This method is called after an update is performed.

You may extend it with your own update process.

public void update ( )