Documentation

CRM_Extension_Container_Basic
in package
implements CRM_Extension_Container_Interface

An extension container is a locally-accessible source tree which can be scanned for extensions.

Table of Contents

Interfaces

CRM_Extension_Container_Interface
An extension container is a locally-accessible source tree which can be scanned for extensions.

Properties

$baseDir  : string
$baseUrl  : string
$cache  : CRM_Utils_Cache_Interface|null
$cacheKey  : string
$relPaths  : array<string|int, mixed>
$relUrls  : array<string|int, mixed>
$filters  : array<string|int, mixed>
$maxDepth  : int|null

Methods

__construct()  : mixed
addFilter()  : $this
Register a filter which determine whether a copy of an extension appears as available.
checkRequirements()  : array<string|int, mixed>
Determine if any unmet requirements prevent use of this container.
convertPathsToUrls()  : array<string|int, mixed>
Convert a list of relative paths to relative URLs.
getBaseDir()  : string
getKeys()  : array_keys
Get a list of extensions available in this container.
getPath()  : mixed
Determine the main .php file for an extension
getResUrl()  : mixed
Determine the base URL for resources provided by the extension.
refresh()  : mixed
Scan the container for available extensions.
getRelPath()  : string
Determine the relative path of an extension directory.
getRelPaths()  : array<string|int, mixed>
Scan $basedir for a list of extension-keys
getRelUrl()  : string
Determine the relative path of an extension directory.
getRelUrls()  : array<string|int, mixed>
Scan $basedir for a list of extension-keys

Properties

$baseDir

public string $baseDir

Note: Treat as private. This is only public to facilitate debugging.

$baseUrl

public string $baseUrl

Note: Treat as private. This is only public to facilitate debugging.

$cacheKey

public string $cacheKey

The cache key used for any data stored by this container

Note: Treat as private. This is only public to facilitate debugging.

$relPaths

public array<string|int, mixed> $relPaths = \FALSE

($key => $relPath)

Note: Treat as private. This is only public to facilitate debugging.

$relUrls

public array<string|int, mixed> $relUrls = \FALSE

($key => $relUrl)

Derived from $relPaths. On Unix systems (where file-paths and URL-paths both use '/' separator), this isn't necessary. On Windows systems, this is derived from $relPaths.

Note: Treat as private. This is only public to facilitate debugging.

$filters

protected array<string|int, mixed> $filters = []

Array(function(CRM_Extension_Info $info): bool) List of callables which determine whether an extension is visible. Each function returns TRUE if the extension should be visible.

$maxDepth

protected int|null $maxDepth

Maximum number of subdirectories to search.

Methods

__construct()

public __construct(string $baseDir, string $baseUrl[, CRM_Utils_Cache_Interface|null $cache = NULL ][, string $cacheKey = NULL ][, int|null $maxDepth = NULL ]) : mixed
Parameters
$baseDir : string

Local path to the container.

$baseUrl : string

Public URL of the container.

$cache : CRM_Utils_Cache_Interface|null = NULL

Cache in which to store extension metadata.

$cacheKey : string = NULL

Unique name for this container.

$maxDepth : int|null = NULL

Maximum number of subdirectories to search.

addFilter()

Register a filter which determine whether a copy of an extension appears as available.

public addFilter(callable $callable) : $this
Parameters
$callable : callable

function(CRM_Extension_Info $info): bool Each function returns TRUE if the extension should be visible.

Return values
$this

checkRequirements()

Determine if any unmet requirements prevent use of this container.

public checkRequirements() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

convertPathsToUrls()

Convert a list of relative paths to relative URLs.

public static convertPathsToUrls(string $dirSep, array<string|int, mixed> $relPaths) : array<string|int, mixed>

Note: Treat as private. This is only public to facilitate testing.

Parameters
$dirSep : string

Directory separator ("/" or "").

$relPaths : array<string|int, mixed>

Array($key => $relPath).

Return values
array<string|int, mixed>

Array($key => $relUrl).

getBaseDir()

public getBaseDir() : string
Return values
string

getKeys()

Get a list of extensions available in this container.

public getKeys() : array_keys
Tags
inheritDoc
Return values
array_keys

getPath()

Determine the main .php file for an extension

public getPath(mixed $key) : mixed
Parameters
$key : mixed

Fully-qualified extension name.

Tags
inheritDoc

getResUrl()

Determine the base URL for resources provided by the extension.

public getResUrl(mixed $key) : mixed
Parameters
$key : mixed

Fully-qualified extension name.

Tags
inheritDoc

refresh()

Scan the container for available extensions.

public refresh() : mixed
Tags
inheritDoc

getRelPaths()

Scan $basedir for a list of extension-keys

protected getRelPaths() : array<string|int, mixed>
Return values
array<string|int, mixed>

($key => $relPath)

getRelUrls()

Scan $basedir for a list of extension-keys

protected getRelUrls() : array<string|int, mixed>
Return values
array<string|int, mixed>

($key => $relUrl)


        
On this page

Search results