class CRM_Extension_Mapper

This class proivdes various helper functions for locating extensions data. It's designed for compatibility with pre-existing functions from CRM_Core_Extensions.

Most of these helper functions originate with the first major iteration of extensions -- a time when every extension had one eponymous PHP class, when there was no PHP class-loader, and when there was special-case logic sprinkled around to handle loading of "extension classes".

With module-extensions (Civi 4.2+), there are no eponymous classes -- instead, module-extensions follow the same class-naming and class-loading practices as core (and don't require special-case logic for class loading). Consequently, the helpers in here aren't much used with module-extensions.

Constants

EXT_TEMPLATES_DIRNAME

Extension info file name.

Properties

protected CRM_Extension_Container_Interface $container
protected array $infos
protected array $moduleExtensions
protected CRM_Utils_Cache_Interface $cache
protected $cacheKey
protected $civicrmPath
protected $civicrmUrl

Methods

__construct( $container, $cache = NULL, null $cacheKey = NULL, null $civicrmPath = NULL, null $civicrmUrl = NULL)

No description

string
classToKey(string $clazz)

Given the class, provides extension's key.

string
classToPath($clazz)

Given the class, provides extension path.

bool
isExtensionKey(string $key)

Given the string, returns true or false if it's an extension key.

bool
isExtensionClass(string $clazz)

Given the string, returns true or false if it's an extension class name.

keyToInfo(string $key, bool $fresh = FALSE)

No description

string
keyToClass(string $key)

Given the key, provides extension's class name.

string
keyToPath(string $key)

Given the key, provides the path to file containing extension's main class.

string
keyToBasePath(string $key)

Given the key, provides the path to file containing extension's main class.

string
keyToUrl(string $key)

Given the key, provides the path to file containing extension's main class.

array
getActiveModuleFiles(bool $fresh = FALSE)

Fetch the list of active extensions of type 'module'

array
getActiveModuleUrls()

Get a list of base URLs for all active modules.

bool
isActiveModule(string $name)

No description

array
getModules()

Get a list of all installed modules, including enabled and disabled ones

string
getTemplatePath(string $clazz)

Given the class, provides the template path.

string
getTemplateName(string $clazz)

Given te class, provides the template name.

refresh()

No description

Details

at line 91
__construct( $container, $cache = NULL, null $cacheKey = NULL, null $civicrmPath = NULL, null $civicrmUrl = NULL)

Parameters

$container
$cache
null $cacheKey
null $civicrmPath
null $civicrmUrl

at line 121
string classToKey(string $clazz)

Given the class, provides extension's key.

Parameters

string $clazz Extension class name.

Return Value

string name of extension key

at line 134
string classToPath($clazz)

Given the class, provides extension path.

Parameters

$clazz

Return Value

string full path the extension .php file

at line 150
bool isExtensionKey(string $key)

Given the string, returns true or false if it's an extension key.

Parameters

string $key A string which might be an extension key.

Return Value

bool true if given string is an extension name

at line 165
bool isExtensionClass(string $clazz)

Given the string, returns true or false if it's an extension class name.

Parameters

string $clazz A string which might be an extension class name.

Return Value

bool true if given string is an extension class name

at line 182
CRM_Extension_Info keyToInfo(string $key, bool $fresh = FALSE)

Parameters

string $key Extension fully-qualified-name.
bool $fresh

Return Value

CRM_Extension_Info

Exceptions

CRM_Extension_Exception
Exception

at line 208
string keyToClass(string $key)

Given the key, provides extension's class name.

Parameters

string $key Extension key.

Return Value

string name of extension's main class

at line 223
string keyToPath(string $key)

Given the key, provides the path to file containing extension's main class.

Parameters

string $key Extension key.

Return Value

string path to file containing extension's main class

at line 237
string keyToBasePath(string $key)

Given the key, provides the path to file containing extension's main class.

Parameters

string $key Extension key.

Return Value

string local path of the extension source tree

at line 255
string keyToUrl(string $key)

Given the key, provides the path to file containing extension's main class.

Parameters

string $key Extension key.

Return Value

string url for resources in this extension

at line 277
array getActiveModuleFiles(bool $fresh = FALSE)

Fetch the list of active extensions of type 'module'

Parameters

bool $fresh whether to forcibly reload extensions list from canonical store.

Return Value

array array(array('prefix' => $, 'file' => $))

at line 330
array getActiveModuleUrls()

Get a list of base URLs for all active modules.

Return Value

array (string $extKey => string $baseUrl)

at line 348
bool isActiveModule(string $name)

Parameters

string $name

Return Value

bool

at line 364
array getModules()

Get a list of all installed modules, including enabled and disabled ones

Return Value

array CRM_Core_Module

at line 385
string getTemplatePath(string $clazz)

Given the class, provides the template path.

Parameters

string $clazz Extension class name.

Return Value

string path to extension's templates directory

at line 407
string getTemplateName(string $clazz)

Given te class, provides the template name.

Parameters

string $clazz Extension class name.

Return Value

string extension's template name

at line 412
refresh()