Module
class Module (View source)
Abstraction of a PHP Package. Can be used to retrieve information about Silverstripe CMS modules, and other packages
managed via composer, by reading their composer.json
file.
Properties
protected | string | $path | Full directory path to this module with no trailing slash |
|
protected | string | $basePath | Base folder of application with no trailing slash |
|
protected | array | $composerData | Cache of composer data |
|
protected | ModuleResource[] | $resources | Loaded resources for this module |
Methods
Gets name of this module. Used as unique key and identifier for this module.
Get full composer name. Will be null
if no composer.json is available
Gets "short" name of this module. This is the base directory this module is installed in.
Name of the resource directory where vendor resources should be exposed as defined by the extra.resources-dir
key in the composer file. A blank string will be returned if the key is undefined.
Details
__construct(string $path, string $basePath)
Construct a module
string
getName()
Gets name of this module. Used as unique key and identifier for this module.
If installed by composer, this will be the full composer name (vendor/name).
If not installed by composer this will default to the basedir()
string|null
getComposerName()
Get full composer name. Will be null
if no composer.json is available
array
getExposedFolders()
Get list of folders that need to be made available
string
getShortName()
Gets "short" name of this module. This is the base directory this module is installed in.
If installed in root, this will be generated from the composer name instead
string
getResourcesDir()
Name of the resource directory where vendor resources should be exposed as defined by the extra.resources-dir
key in the composer file. A blank string will be returned if the key is undefined.
Only applicable when reading the composer file for the main project.
string
getPath()
Get base path for this module
string
getRelativePath()
Get path relative to base dir.
If module path is base this will be empty string
array
__serialize()
No description
void
__unserialize(array $data)
No description
activate()
Activate _config.php for this module, if one exists
protected
loadComposer()
No description
ModuleResource
getResource(string $path)
Get resource for this module