CRM_Core_Region
in package
implements
CRM_Core_Resources_CollectionInterface, CRM_Core_Resources_CollectionAdderInterface
uses
CRM_Core_Resources_CollectionTrait
Maintain a set of markup/templates to inject inside various regions
Table of Contents
Interfaces
- CRM_Core_Resources_CollectionInterface
- Class CRM_Core_Resources_CollectionInterface
- CRM_Core_Resources_CollectionAdderInterface
- The collection-adder interface provides write-only support for a collection.
Properties
- $_name : string
- Symbolic name of this region
- $defaults : array<string|int, mixed>
- Static defaults - a list of options to apply to any new snippets.
- $isSorted : bool
- Whether the snippets array has been sorted
- $snippets : array<string|int, mixed>
- List of snippets to inject within region.
- $types : array<string|int, mixed>
- Whitelist of supported types.
Methods
- __construct() : mixed
- _cmpSnippet() : int
- add() : array<string|int, mixed>
- Add an item to the collection.
- addBundle() : static
- Assimilate all the resources listed in a bundle.
- clear() : static
- Remove all snippets.
- filter() : static
- Alter the contents of the collection.
- find() : iterable<string|int, mixed>
- Find all snippets which match the given criterion.
- findCreateSettingSnippet() : array<string|int, mixed>
- get() : array<string|int, mixed>|null
- Get snippet.
- getAll() : iterable<string|int, mixed>
- Get a list of all snippets in this collection.
- getSettings() : array<string|int, mixed>
- Get a fully-formed/altered list of settings, including the results of any callbacks/listeners.
- instance() : CRM_Core_Region
- Obtain the content for a given region.
- merge() : static
- Assimilate a list of resources into this list.
- render() : mixed
- Render all the snippets in a region.
- update() : static
- Update specific properties of a snippet.
- nextId() : mixed
- resolveName() : mixed
- sort() : static
- Ensure that the collection is sorted.
Properties
$_name
Symbolic name of this region
public
string
$_name
$defaults
Static defaults - a list of options to apply to any new snippets.
protected
array<string|int, mixed>
$defaults
= ['weight' => 1, 'disabled' => \FALSE]
$isSorted
Whether the snippets array has been sorted
protected
bool
$isSorted
= \TRUE
$snippets
List of snippets to inject within region.
protected
array<string|int, mixed>
$snippets
= []
e.g. $this->_snippets[3]['type'] = 'template';
$types
Whitelist of supported types.
protected
array<string|int, mixed>
$types
= []
Methods
__construct()
public
__construct(string $name) : mixed
Parameters
- $name : string
_cmpSnippet()
public
static _cmpSnippet(mixed $a, mixed $b) : int
Parameters
- $a : mixed
- $b : mixed
Return values
intadd()
Add an item to the collection.
public
add(array<string|int, mixed> $snippet) : array<string|int, mixed>
Parameters
- $snippet : array<string|int, mixed>
-
Resource options. See CollectionInterface docs.
Tags
Return values
array<string|int, mixed> —The full/computed snippet (with defaults applied).
addBundle()
Assimilate all the resources listed in a bundle.
public
addBundle(iterable<string|int, mixed>|string|CRM_Core_Resources_Bundle $bundle) : static
Parameters
- $bundle : iterable<string|int, mixed>|string|CRM_Core_Resources_Bundle
-
Either bundle object, or the symbolic name of a bundle. Note: For symbolic names, the bundle must be a container service ('bundle.FOO').
Return values
staticclear()
Remove all snippets.
public
clear() : static
Tags
Return values
staticfilter()
Alter the contents of the collection.
public
filter(callable $callback) : static
Parameters
- $callback : callable
-
The callback is invoked once for each member in the collection. The callback may return one of three values:
- TRUE: The item is OK and belongs in the collection.
- FALSE: The item is not OK and should be omitted from the collection.
- Array: The item should be revised (using the returned value).
Tags
Return values
staticfind()
Find all snippets which match the given criterion.
public
find(callable $callback) : iterable<string|int, mixed>
Parameters
- $callback : callable
-
The callback is invoked once for each member in the collection. The callback may return one of three values:
- TRUE: The item is OK and belongs in the collection.
- FALSE: The item is not OK and should be omitted from the collection.
Tags
Return values
iterable<string|int, mixed> —List of matching snippets.
findCreateSettingSnippet()
public
& findCreateSettingSnippet([mixed $options = [] ]) : array<string|int, mixed>
Parameters
- $options : mixed = []
Return values
array<string|int, mixed>get()
Get snippet.
public
& get(string $name) : array<string|int, mixed>|null
Parameters
- $name : string
Tags
Return values
array<string|int, mixed>|nullgetAll()
Get a list of all snippets in this collection.
public
getAll() : iterable<string|int, mixed>
Tags
Return values
iterable<string|int, mixed>getSettings()
Get a fully-formed/altered list of settings, including the results of any callbacks/listeners.
public
getSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>instance()
Obtain the content for a given region.
public
static & instance(string $name[, bool $autocreate = TRUE ]) : CRM_Core_Region
Parameters
- $name : string
- $autocreate : bool = TRUE
-
Whether to automatically create an empty region.
Return values
CRM_Core_Regionmerge()
Assimilate a list of resources into this list.
public
merge(iterable<string|int, mixed> $snippets) : static
Parameters
- $snippets : iterable<string|int, mixed>
-
List of snippets to add.
Tags
Return values
staticrender()
Render all the snippets in a region.
public
render(string $default[, bool $allowCmsOverride = TRUE ]) : mixed
Parameters
- $default : string
-
HTML, the initial content of the region.
- $allowCmsOverride : bool = TRUE
-
Allow CMS to override rendering of region.
Tags
update()
Update specific properties of a snippet.
public
update(string $name, array<string|int, mixed> $snippet) : static
Parameters
- $name : string
-
Symbolic of the resource/snippet to update.
- $snippet : array<string|int, mixed>
-
Resource options. See CollectionInterface docs.
Tags
Return values
staticnextId()
protected
nextId() : mixed
resolveName()
protected
resolveName(string $name) : mixed
Parameters
- $name : string
-
Name or alias. return array List of real names.
sort()
Ensure that the collection is sorted.
protected
sort() : static