Documentation

CRM_Extension_MixInfo
in package

"Mixins" allow extensions to be initialized with small, reusable chunks of code.

Example: A mixin might scan an extension for YAML files, aggregate them, add that to the boot-cache, and use the results to register event-listeners during initialization.

Mixins have the following characteristics:

  • They are defined by standalone PHP files, e.g. civix@1.0.2.mixin.php
  • They are implicitly versioned via strict SemVer. (1.1.0 can replace 1.0.0; 2.0.0 and 1.0.0 are separate/parallel things).
  • They are activated via info.xml (<mix>civix@1.0</mix>).
  • They may be copied/reproduced in multiple extensions.
  • They are de-duped - such that a major-version (eg civix@1 or civix@2) is only loaded once.

The "MixInfo" record tracks the mixins needed by an extension. You may consider this an optimized subset of the 'info.xml'. (The mix-info is loaded on every page-view, so this record is serialized and stored in the MixinLoader cache.)

Table of Contents

Properties

$longName  : string
$mixins  : array<string|int, mixed>
$path  : string|null
$shortName  : string

Methods

getPath()  : string
Get a path relative to the target extension.
isActive()  : mixed

Properties

$longName

public string $longName

Ex: 'org.civicrm.flexmailer'

$mixins

public array<string|int, mixed> $mixins

Ex: ['civix@2.0', 'menu@1.0']

$path

public string|null $path

Ex: '/var/www/modules/civicrm/ext/flexmailer'.

$shortName

public string $shortName

Ex: 'flexmailer'

Methods

getPath()

Get a path relative to the target extension.

public getPath([string $relPath = NULL ]) : string
Parameters
$relPath : string = NULL
Return values
string

isActive()

public isActive() : mixed

        
On this page

Search results