Documentation

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
int

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
static

filter()

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
see
CRM_Core_Resources_CollectionInterface::filter()
Return values
static

find()

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
see
CRM_Core_Resources_CollectionInterface::find()
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>

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_Region

render()

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
@return

string, HTML

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
see
CRM_Core_Resources_CollectionInterface::update()
Return values
static

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
Return values
static

        
On this page

Search results