Documentation

CRM_Utils_Hook_Soap extends CRM_Utils_Hook
in package

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

Table of Contents

Constants

DASHBOARD_ABOVE  = 2
DASHBOARD_BELOW  = 1
DASHBOARD_REPLACE  = 3
SUMMARY_ABOVE  = 2
SUMMARY_BELOW  = 1
SUMMARY_REPLACE  = 3
create your own summaries

Properties

$_nullObject  : null
Object to pass when an object is required to be passed by params.
$cache  : CRM_Utils_Cache_Interface
$_singleton  : CRM_Utils_Hook
We only need one instance of this object. So we use the singleton pattern and cache the instance in this variable
$commonCiviModules  : array<string|int, mixed>|string
$commonIncluded  : bool

Methods

__construct()  : mixed
CRM_Utils_Hook constructor.
aclGroup()  : null
Called when restricting access to contact-groups or custom_field-groups or profile-groups.
aclWhereClause()  : null
This hook is called when composing the ACL where clause to restrict visibility of contacts to the logged in user
activeTheme()  : null
The activeTheme hook determines which theme is active.
alterAdminPanel()  : mixed
This hook allows modification of the admin panels
alterAngular()  : mixed
Alter the definition of some Angular HTML partials.
alterAPIPermissions()  : mixed
This hook is called when API permissions are checked (cf. civicrm_api3_api_check_permission() in api/v3/utils.php and _civicrm_api3_permissions() in CRM/Core/DAO/permissions.php).
alterBadge()  : null
This hook is invoked when building a CiviCRM name badge.
alterBarcode()  : mixed
This hook is called before encoding data in barcode.
alterBundle()  : null
Alter the contents of a resource bundle (ie a collection of JS/CSS/etc).
alterCalculatedMembershipStatus()  : mixed
This hook is called when membership status is being calculated.
alterContent()  : mixed
This hooks allows alteration of generated page content.
alterCustomFieldDisplayValue()  : mixed
This hook is called to alter Custom field value before its displayed.
alterDeferredRevenueItems()  : mixed
This hook is called to alter Deferred revenue item values just before they are inserted in civicrm_financial_trxn table
alterDisplayName()  : mixed
Issue CRM-14276 Add a hook for altering the display name
alterEntityRefParams()  : mixed
This hook is called to modify api params of EntityRef form field
alterLocationMergeData()  : mixed
This hook allows modification of the data calculated for merging locations.
alterLogTables()  : mixed
This hook allows changes to the spec of which tables to log.
alterMailContent()  : mixed
This hook is called after getting the content of the mail and before tokenizing it.
alterMailer()  : mixed
Modify or replace the Mailer object used for outgoing mail.
alterMailingLabelParams()  : mixed
Hook definition for altering the generation of Mailing Labels.
alterMailingRecipients()  : mixed
This hook is called before and after constructing mail recipients.
alterMailParams()  : mixed
This hook is called when an email is about to be sent by CiviCRM.
alterMailStore()  : mixed
This hook is called when loading a mail-store (e.g. IMAP, POP3, or Maildir).
alterMenu()  : null
This hook is called when building the menu table.
alterPaymentProcessorParams()  : mixed
Hook definition for altering payment parameters before talking to a payment processor back end.
alterRedirect()  : null
Alter redirect.
alterReportVar()  : mixed
alterResourceSettings()  : mixed
Modify the CRM_Core_Resources settings data.
alterSettingsFolders()  : mixed
This hook is called when Settings specifications are loaded.
alterSettingsMetaData()  : mixed
This hook is called when Settings have been loaded from the xml It is an opportunity for hooks to alter the data
alterTemplateFile()  : mixed
This hooks allows alteration of the tpl file used to generate content. It differs from the altercontent hook as the content has already been rendered through the tpl at that point
alterUFFields()  : mixed
Allow extensions to modify the array of acceptable fields to be included on profiles
angularModules()  : null
Register Angular modules
apiWrappers()  : null
This hook is called before running an api call.
batchItems()  : mixed
This hook is called when the entries of the CSV Batch export are mapped.
batchQuery()  : mixed
This hook is called when a query string of the CSV Batch export is generated.
buildAmount()  : null
This hook is called when building the amount structure for a Contribution or Event Page.
buildAsset()  : null
This hook is called whenever the system builds a new copy of semi-static asset.
buildForm()  : null
This hook is invoked when building a CiviCRM form. This hook should also be used to set the default values of a form element
buildGroupContactCache()  : void
Build the group contact cache for the relevant group.
buildProfile()  : mixed
This hook is called while preparing a profile form.
buildStateProvinceForCountry()  : null
This hook is called when building the state list for a particular country.
buildUFGroupsForModule()  : null
This hook is called when uf groups are being built for a module.
caseChange()  : mixed
This hook fires whenever a record in a case changes.
caseEmailSubjectPatterns()  : mixed
This hook is called when getting case email subject patterns.
caseSummary()  : array<string|int, mixed>
This hook is called when rendering the Manage Case screen.
caseTypes()  : mixed
This hook is called when locating CiviCase types.
check()  : mixed
Check system status.
commonBuildModuleList()  : mixed
Build the list of modules to be processed for hooks.
commonInvoke()  : array<string|int, mixed>|bool
config()  : mixed
You can use this hook to modify the config object and hence behavior of CiviCRM dynamically.
contactListQuery()  : mixed
Use this hook to populate the list of contacts returned by Contact Reference custom fields.
container()  : mixed
Modify the CiviCRM container - add new services, parameters, extensions, etc.
copy()  : null
This hook is called after a copy of an object has been made. The current objects are Event, Contribution Page and UFGroup
coreResourceList()  : mixed
This hook is called when core resources are being loaded
cron()  : null
This hook is called before running pending cron jobs.
crypto()  : mixed
Register cryptographic resources, such as keys and cipher-suites.
cryptoRotateKey()  : null
Rotate the cryptographic key used in the database.
custom()  : null
This hook is called after a db write on a custom table.
customPre()  : null
This hook is called before a db write on a custom table.
dashboard()  : string
This hook is called when rendering the dashboard (q=civicrm/dashboard)
dashboard_defaults()  : mixed
This hook is called while initializing the default dashlets for a contact dashboard.
disable()  : mixed
This hook is called when a module-extension is disabled.
dupeQuery()  : mixed
This hook allows modification of the queries constructed from dupe rules.
emailProcessor()  : mixed
This hook is called AFTER EACH email has been processed by the script bin/EmailProcessor.php
emailProcessorContact()  : null
This hook is called when we are determining the contactID for a specific email address
enable()  : mixed
This hook is called when a module-extension is re-enabled.
entityRefFilters()  : mixed
Allows the list of filters on the EntityRef widget to be altered.
entityTypes()  : null
This hook is called for declaring entities.
esmImportMap()  : void
Build a list of ECMAScript Modules (ESM's) that are available for auto-loading.
eventDefs()  : mixed
Build a description of available hooks.
eventDiscount()  : mixed
export()  : mixed
This hook is called before record is exported as CSV.
fieldOptions()  : mixed
Hook for modifying field options
fileSearches()  : mixed
findDuplicates()  : mixed
Check for duplicate contacts
geocoderFormat()  : mixed
This hook is called when a geocoder's format method is called.
getAssetUrl()  : null
This hook is called when building a link to a semi-static asset.
idsException()  : mixed
This hook is called for bypass a few civicrm urls from IDS check.
import()  : mixed
This hook is called after a row has been processed and the record (and associated records imported
importAlterMappedRow()  : mixed
Alter import mappings.
inboundSMS()  : mixed
This hook is called before an inbound SMS is processed.
install()  : mixed
Run early installation steps for an extension. Ex: Create new MySQL table.
invalidateChecksum()  : mixed
Allows an extension to override the checksum validation.
invoke()  : mixed
Invoke a hook.
invokeViaUF()  : mixed
Invoke a hook through the UF/CMS hook system and the extension-hook system.
links()  : null
This hook retrieves links from other modules and injects it into.
mailingGroups()  : mixed
This hook is called when composing a mailing. You can include / exclude other groups as needed.
mailingTemplateTypes()  : mixed
Modify the list of template-types used for CiviMail composition.
mailSetupActions()  : mixed
When adding a new "Mail Account" (`MailSettings`), present a menu of setup options.
managed()  : null
This hook is called for declaring managed entities via API.
membershipTypeValues()  : mixed
This hook is called when composing the array of membershipTypes and their cost during a membership registration (new or renewal).
merge()  : mixed
This hook allows modification of the data used to perform merging of duplicates.
navigationMenu()  : mixed
This hook allows modification of the navigation menu.
notePrivacy()  : mixed
Deprecated: use hook_civicrm_selectWhereClause instead.
optionValues()  : mixed
This hooks allows to change option values.
pageRun()  : null
This hook is called before a CiviCRM Page is rendered. You can use this hook to insert smarty variables in a template
permission()  : null
This hook is called when exporting Civi's permission to the CMS. Use this hook to modify the array of system permissions for CiviCRM.
permission_check()  : null
This hook is called when checking permissions; use this hook to dynamically escalate user permissions in certain use cases (cf. CRM-19256).
permissionList()  : null
This hook is used to enumerate the list of available permissions. It may include concrete permissions defined by Civi, concrete permissions defined by the CMS, and/or synthetic permissions.
post()  : mixed
This hook is called after a db write on some core objects.
post_case_merge()  : mixed
This hook is called after a case merge (or a case reassign)
postCommit()  : mixed
This hook is equivalent to post(), except that it is guaranteed to run outside of any SQL transaction. The objectRef is not modifiable.
postEmailSend()  : mixed
This hook is called when an email has been successfully sent by CiviCRM, but not on an error.
postInstall()  : mixed
Run later installation steps. Ex: Call a bespoke API-job for the first time.
postIPNProcess()  : mixed
Allow Extensions to custom process IPN hook data such as sending Google Analytics information based on the IPN
postJob()  : mixed
This hook is called after a scheduled job is executed
postMailing()  : mixed
This hook is called when a CiviMail mailing has completed
postProcess()  : null
This hook is invoked when a CiviCRM form is submitted. If the module has injected any form elements, this hook should save the values in the database
postSave()  : mixed
pre()  : null
This hook is called before a db write on some core objects.
pre_case_merge()  : mixed
This hook is called before a case merge (or a case reassign)
preJob()  : mixed
This hook is called before a scheduled job is executed
preProcess()  : null
This hook is invoked during the CiviCRM form preProcess phase.
processProfile()  : mixed
This hook is called processing a valid profile form submission.
queryObjects()  : mixed
This hook is called while building the core search query, so hook implementers can provide their own query objects which alters/extends core search.
queueActive()  : void
Should queue processing proceed.
queueRun()  : mixed
Fire `hook_civicrm_queueRun_{$runner}`.
queueStatus()  : void
Fired if the status of a queue changes.
queueTaskError()  : mixed
This is called if automatic execution of a queue-task fails.
recent()  : array<string|int, mixed>
This hook is called before storing recently viewed items.
referenceCounts()  : mixed
Determine how many other records refer to a given record.
requireCiviModules()  : mixed
runHooks()  : array<string|int, mixed>|bool
Run hooks.
scanClasses()  : mixed
Scan extensions for a list of auto-registered interfaces.
searchColumns()  : mixed
This hook is called from CRM_Core_Selector_Controller through which all searches in civicrm go.
searchProfile()  : mixed
This hook is called while preparing a list of contacts (based on a profile)
searchTasks()  : mixed
This hook is called to display the list of actions allowed after doing a search.
selectWhereClause()  : void
singleton()  : CRM_Utils_Hook
Constructor and getter for the singleton instance.
summary()  : string
This hook is called when rendering the contact summary.
summaryActions()  : mixed
This hook allows user to customize context menu Actions on contact summary page.
tabset()  : null
This hook is called when rendering the tabs used for events and potentially contribution pages, etc.
themes()  : null
A theme is a set of CSS files which are loaded on CiviCRM pages. To register a new theme, add it to the $themes array. Use these properties:
tokens()  : null
This hook is called when sending an email / printing labels
tokenValues()  : null
This hook is called when sending an email / printing labels to get the values for all the tokens returned by the 'tokens' hook
translateFields()  : mixed
Define the list of fields supported in APIv4 data-translation.
unhandledException()  : mixed
uninstall()  : mixed
This hook is called when a module-extension is uninstalled.
unsubscribeGroups()  : mixed
This hook is called when a contact unsubscribes from a mailing. It allows modules to override what the contacts are removed from.
upgrade()  : bool|null
This hook is called to drive database upgrades for extension-modules.
validateForm()  : mixed
This hook is invoked during all CiviCRM form validation. An array of errors detected is returned. Else we assume validation succeeded.
validateProfile()  : mixed
This hook is called while validating a profile form submission.
viewProfile()  : mixed
This hook is called while preparing a read-only profile screen
xmlMenu()  : null
This hook is called when building the menu table.

Constants

DASHBOARD_ABOVE

public mixed DASHBOARD_ABOVE = 2

DASHBOARD_BELOW

public mixed DASHBOARD_BELOW = 1

DASHBOARD_REPLACE

public mixed DASHBOARD_REPLACE = 3

SUMMARY_ABOVE

public mixed SUMMARY_ABOVE = 2

SUMMARY_BELOW

public mixed SUMMARY_BELOW = 1

SUMMARY_REPLACE

create your own summaries

public mixed SUMMARY_REPLACE = 3

Properties

$_nullObject

Object to pass when an object is required to be passed by params.

public static null $_nullObject = \NULL

This is supposed to be a convenience but note that it is a bad pattern as it can get contaminated & result in hard-to-diagnose bugs.

$_singleton

We only need one instance of this object. So we use the singleton pattern and cache the instance in this variable

private static CRM_Utils_Hook $_singleton

$commonCiviModules

private array<string|int, mixed>|string $commonCiviModules = []

$commonIncluded

private bool $commonIncluded = \FALSE

Methods

aclGroup()

Called when restricting access to contact-groups or custom_field-groups or profile-groups.

public static aclGroup(int $type, int $contactID, string $tableName, array<string|int, mixed> &$allGroups, array<string|int, int> &$currentGroups) : null

Hook subscribers should alter the array of $currentGroups by reference.

Parameters
$type : int

Action type being performed e.g. CRM_ACL_API::VIEW or CRM_ACL_API::EDIT

$contactID : int

User contactID for whom the check is made.

$tableName : string

Table name of group, e.g. 'civicrm_group' or 'civicrm_uf_group' or 'civicrm_custom_group'.

$allGroups : array<string|int, mixed>

All groups from the above table, keyed by id.

$currentGroups : array<string|int, int>

Ids of allowed groups (corresponding to array keys of $allGroups) to be altered by reference.

Return values
null

the return value is ignored

aclWhereClause()

This hook is called when composing the ACL where clause to restrict visibility of contacts to the logged in user

public static aclWhereClause(int $type, array<string|int, mixed> &$tables, array<string|int, mixed> &$whereTables, int &$contactID, string &$where) : null
Parameters
$type : int

Action being taken (CRM_Core_Permission::VIEW or CRM_Core_Permission::EDIT)

$tables : array<string|int, mixed>

(reference ) add the tables that are needed for the select clause.

$whereTables : array<string|int, mixed>

(reference ) add the tables that are needed for the where clause.

$contactID : int

The contactID for whom the check is made.

$where : string

The currrent where clause.

Return values
null

the return value is ignored

activeTheme()

The activeTheme hook determines which theme is active.

public static activeTheme(string &$theme, array<string|int, mixed> $context) : null
Parameters
$theme : string

The identifier for the theme. Alterable. Ex: 'greenwich'.

$context : array<string|int, mixed>

Information about the current page-request. Includes some mix of:

  • page: the relative path of the current Civi page (Ex: 'civicrm/dashboard').
  • themes: an instance of the Civi\Core\Themes service.
Return values
null

the return value is ignored

alterAdminPanel()

This hook allows modification of the admin panels

public static alterAdminPanel(array<string|int, mixed> &$panels) : mixed
Parameters
$panels : array<string|int, mixed>

Associated array of admin panels

alterAngular()

Alter the definition of some Angular HTML partials.

public static alterAngular(Manager $angular) : mixed
Parameters
$angular : Manager
function example_civicrm_alterAngular($angular) {
  $changeSet = \Civi\Angular\ChangeSet::create('mychanges')
    ->alterHtml('~/crmMailing/EditMailingCtrl/2step.html', function(phpQueryObject $doc) {
      $doc->find('[ng-form="crmMailingSubform"]')->attr('cat-stevens', 'ts(\'wild world\')');
    })
  );
  $angular->add($changeSet);
}

alterAPIPermissions()

This hook is called when API permissions are checked (cf. civicrm_api3_api_check_permission() in api/v3/utils.php and _civicrm_api3_permissions() in CRM/Core/DAO/permissions.php).

public static alterAPIPermissions(string $entity, string $action, array<string|int, mixed> &$params, array<string|int, mixed> &$permissions) : mixed
Parameters
$entity : string

The API entity (like contact).

$action : string

The API action (like get).

$params : array<string|int, mixed>

the API parameters

$permissions : array<string|int, mixed>

the associative permissions array (probably to be altered by this hook)

alterBadge()

This hook is invoked when building a CiviCRM name badge.

public static alterBadge(string $labelName, object &$label, array<string|int, mixed> &$format, array<string|int, mixed> &$participant) : null
Parameters
$labelName : string

String referencing name of badge format.

$label : object

Reference to the label object.

$format : array<string|int, mixed>

Array of format data.

$participant : array<string|int, mixed>

Array of participant values.

Return values
null

the return value is ignored

alterBarcode()

This hook is called before encoding data in barcode.

public static alterBarcode(array<string|int, mixed> &$data[, string $type = 'barcode' ][, string $context = 'name_badge' ]) : mixed
Parameters
$data : array<string|int, mixed>

Associated array of values available for encoding.

$type : string = 'barcode'

Type of barcode, classic barcode or QRcode.

$context : string = 'name_badge'

Where this hooks is invoked.

alterCalculatedMembershipStatus()

This hook is called when membership status is being calculated.

public static alterCalculatedMembershipStatus(array<string|int, mixed> &$membershipStatus, array<string|int, mixed> $arguments, array<string|int, mixed> $membership) : mixed
Parameters
$membershipStatus : array<string|int, mixed>

Membership status details as determined - alter if required.

$arguments : array<string|int, mixed>

Arguments passed in to calculate date.

  • 'start_date'
  • 'end_date'
  • 'status_date'
  • 'join_date'
  • 'exclude_is_admin'
  • 'membership_type_id'
$membership : array<string|int, mixed>

Membership details from the calling function.

alterContent()

This hooks allows alteration of generated page content.

public static alterContent(mixed &$content, mixed $context, mixed $tplName, mixed &$object) : mixed
Parameters
$content : mixed

Previously generated content.

$context : mixed

Context of content - page or form.

$tplName : mixed

The file name of the tpl.

$object : mixed

A reference to the page or form object.

alterCustomFieldDisplayValue()

This hook is called to alter Custom field value before its displayed.

public static alterCustomFieldDisplayValue(string &$displayValue, mixed $value, int $entityId, array<string|int, mixed> $fieldInfo) : mixed
Parameters
$displayValue : string
$value : mixed
$entityId : int
$fieldInfo : array<string|int, mixed>

alterDeferredRevenueItems()

This hook is called to alter Deferred revenue item values just before they are inserted in civicrm_financial_trxn table

public static alterDeferredRevenueItems(array<string|int, mixed> &$deferredRevenues, CRM_Contribute_BAO_Contribution $contributionDetails, bool $update, string $context) : mixed
Parameters
$deferredRevenues : array<string|int, mixed>
$contributionDetails : CRM_Contribute_BAO_Contribution
$update : bool
$context : string

alterDisplayName()

Issue CRM-14276 Add a hook for altering the display name

public static alterDisplayName(string &$displayName, int $contactId, CRM_Core_DAO $dao) : mixed

hook_civicrm_contact_get_displayname(&$display_name, $contactId, $dao)

Parameters
$displayName : string
$contactId : int
$dao : CRM_Core_DAO

A DAO object containing contact fields + primary email field as "email".

alterEntityRefParams()

This hook is called to modify api params of EntityRef form field

public static alterEntityRefParams(array<string|int, mixed> &$params, string $formName) : mixed
Parameters
$params : array<string|int, mixed>
$formName : string

alterLocationMergeData()

This hook allows modification of the data calculated for merging locations.

public static alterLocationMergeData(array<string|int, mixed> &$blocksDAO, int $mainId, int $otherId, array<string|int, mixed> $migrationInfo) : mixed
Parameters
$blocksDAO : array<string|int, mixed>

Array of location DAO to be saved. These are arrays in 2 keys 'update' & 'delete'.

$mainId : int

Contact_id of the contact that survives the merge.

$otherId : int

Contact_id of the contact that will be absorbed and deleted.

$migrationInfo : array<string|int, mixed>

Calculated migration info, informational only.

alterLogTables()

This hook allows changes to the spec of which tables to log.

public static alterLogTables(array<string|int, mixed> &$logTableSpec) : mixed
Parameters
$logTableSpec : array<string|int, mixed>

alterMailContent()

This hook is called after getting the content of the mail and before tokenizing it.

public static alterMailContent(array<string|int, mixed> &$content) : mixed
Parameters
$content : array<string|int, mixed>

Array fields include: html, text, subject

alterMailer()

Modify or replace the Mailer object used for outgoing mail.

public static alterMailer(object &$mailer, string $driver, array<string|int, mixed> $params) : mixed
Parameters
$mailer : object

The default mailer produced by normal configuration; a PEAR "Mail" class (like those returned by Mail::factory)

$driver : string

The type of the default mailer (eg "smtp", "sendmail", "mock", "CRM_Mailing_BAO_Spool")

$params : array<string|int, mixed>

The default mailer config options

Tags
see
Mail::factory

alterMailingLabelParams()

Hook definition for altering the generation of Mailing Labels.

public static alterMailingLabelParams(array<string|int, mixed> &$args) : mixed
Parameters
$args : array<string|int, mixed>

An array of the args in the order defined for the tcpdf multiCell api call. with the variable names below converted into string keys (ie $w become 'w' as the first key for $args) float $w Width of cells. If 0, they extend up to the right margin of the page. float $h Cell minimum height. The cell extends automatically if needed. string $txt String to print mixed $border Indicates if borders must be drawn around the cell block. The value can be either a number:

  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
string $align Allows to center or align the text. Possible values are:
  • L or empty string: left align
  • C: center
  • R: right align
  • J: justification (default value when $ishtml=false)
int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. int $ln Indicates where the current position should go after the call. Possible values are:
  • 0: to the right
  • 1: to the beginning of the next line [DEFAULT]
  • 2: below
float $x x position in user units float $y y position in user units boolean $reseth if true reset the last cell height (default true). int $stretch stretch character mode:
  • 0 = disabled
  • 1 = horizontal scaling only if necessary
  • 2 = forced horizontal scaling
  • 3 = character spacing only if necessary
  • 4 = forced character spacing
boolean $ishtml set to true if $txt is HTML content (default = false). boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width. float $maxh maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. This feature works only when $ishtml=false.

alterMailingRecipients()

This hook is called before and after constructing mail recipients.

public static alterMailingRecipients(CRM_Mailing_DAO_Mailing &$mailingObject, array<string|int, mixed> &$criteria, string $context) : mixed

Allows user to alter filter and/or search query to fetch mail recipients

Parameters
$mailingObject : CRM_Mailing_DAO_Mailing
$criteria : array<string|int, mixed>

A list of SQL criteria; you can add/remove/replace/modify criteria. Array(string $name => CRM_Utils_SQL_Select $criterion). Ex: array('do_not_email' => CRM_Utils_SQL_Select::fragment()->where("$contact.do_not_email = 0")).

$context : string

Ex: 'pre', 'post'

alterMailParams()

This hook is called when an email is about to be sent by CiviCRM.

public static alterMailParams(array<string|int, mixed> &$params[, string $context = NULL ]) : mixed
Parameters
$params : array<string|int, mixed>

Array fields include: groupName, from, toName, toEmail, subject, cc, bcc, text, html, returnPath, replyTo, headers, attachments (array)

$context : string = NULL

The context in which the hook is being invoked, eg 'civimail'.

alterMailStore()

This hook is called when loading a mail-store (e.g. IMAP, POP3, or Maildir).

public static alterMailStore(array<string|int, mixed> &$params) : mixed
Parameters
$params : array<string|int, mixed>

Most fields correspond to data in the MailSettings entity:

  • id: int
  • server: string
  • username: string
  • password: string
  • is_ssl: bool
  • source: string
  • local_part: string

With a few supplements

  • protocol: string, symbolic protocol name (e.g. "IMAP")
  • factory: callable, the function which instantiates the driver class
  • auth: string, (for some drivers) specify the authentication method (eg "Password" or "XOAuth2")

alterMenu()

This hook is called when building the menu table.

public static alterMenu(array<string|int, mixed> &$items) : null
Parameters
$items : array<string|int, mixed>

List of records to include in menu table.

Return values
null

the return value is ignored

alterPaymentProcessorParams()

Hook definition for altering payment parameters before talking to a payment processor back end.

public static alterPaymentProcessorParams(CRM_Core_Payment $paymentObj, array<string|int, mixed>|PropertyBag &$rawParams, array<string|int, mixed>|PropertyBag &$cookedParams) : mixed

Definition will look like this:

function hook_civicrm_alterPaymentProcessorParams( $paymentObj, &$rawParams, &$cookedParams );

Parameters
$paymentObj : CRM_Core_Payment

Instance of payment class of the payment processor invoked (e.g., 'CRM_Core_Payment_Dummy') See discussion in CRM-16224 as to whether $paymentObj should be passed by reference.

$rawParams : array<string|int, mixed>|PropertyBag

array of params as passed to to the processor

$cookedParams : array<string|int, mixed>|PropertyBag

params after the processor code has translated them into its own key/value pairs

Return values
mixed

This return is not really intended to be used.

alterRedirect()

Alter redirect.

public static alterRedirect(UriInterface &$url, array<string|int, mixed> &$context) : null

This hook is called when the browser is being re-directed and allows the url to be altered.

Parameters
$url : UriInterface
$context : array<string|int, mixed>

Additional information about context

  • output - if this is 'json' then it will return json.
Return values
null

the return value is ignored

alterReportVar()

public static alterReportVar(mixed $varType, mixed &$var, mixed &$object) : mixed
Parameters
$varType : mixed
$var : mixed
$object : mixed

alterResourceSettings()

Modify the CRM_Core_Resources settings data.

public static alterResourceSettings(array<string|int, mixed> &$data) : mixed
Parameters
$data : array<string|int, mixed>
Tags
see
CRM_Core_Resources::addSetting

alterSettingsFolders()

This hook is called when Settings specifications are loaded.

public static alterSettingsFolders(array<string|int, mixed> &$settingsFolders) : mixed
Parameters
$settingsFolders : array<string|int, mixed>

List of paths from which to derive metadata

alterSettingsMetaData()

This hook is called when Settings have been loaded from the xml It is an opportunity for hooks to alter the data

public static alterSettingsMetaData(array<string|int, mixed> &$settingsMetaData, int $domainID, mixed $profile) : mixed
Parameters
$settingsMetaData : array<string|int, mixed>

Settings Metadata.

$domainID : int
$profile : mixed

alterTemplateFile()

This hooks allows alteration of the tpl file used to generate content. It differs from the altercontent hook as the content has already been rendered through the tpl at that point

public static alterTemplateFile(mixed $formName, mixed &$form, mixed $context, mixed &$tplName) : mixed
Parameters
$formName : mixed

Previously generated content.

$form : mixed

Reference to the form object.

$context : mixed

Context of content - page or form.

$tplName : mixed

Reference the file name of the tpl.

alterUFFields()

Allow extensions to modify the array of acceptable fields to be included on profiles

public static alterUFFields(array<string|int, mixed> &$fields) : mixed
Parameters
$fields : array<string|int, mixed>

format is [Entity => array of DAO fields]

angularModules()

Register Angular modules

public static angularModules(array<string|int, mixed> &$angularModules) : null
Parameters
$angularModules : array<string|int, mixed>

List of modules. Each module defines:

  • ext: string, the CiviCRM extension which hosts the files.
  • js: array, list of JS files or globs.
  • css: array, list of CSS files or globs.
  • partials: array, list of base-dirs containing HTML.
  • partialsCallback: mixed, a callback function which generates a list of HTML function(string $moduleName, array $moduleDefn) => array(string $file => string $html) For future-proofing, use a serializable callback (e.g. string/array). See also: Civi\Core\Resolver.
  • requires: array, list of required Angular modules.
  • basePages: array, unconditionally load this module onto the given Angular pages. [v4.7.21+] If omitted, default to "array('civicrm/a')" for backward compat. For a utility that should only be loaded on-demand, use "array()". For a utility that should be loaded in all pages use, "array('*')".
function mymod_civicrm_angularModules(&$angularModules) {
  $angularModules['myAngularModule'] = array(
    'ext' => 'org.example.mymod',
    'js' => array('js/myAngularModule.js'),
  );
  $angularModules['myBigAngularModule'] = array(
    'ext' => 'org.example.mymod',
    'js' => array('js/part1.js', 'js/part2.js', 'ext://other.ext.name/file.js', 'assetBuilder://dynamicAsset.js'),
    'css' => array('css/myAngularModule.css', 'ext://other.ext.name/file.css', 'assetBuilder://dynamicAsset.css'),
    'partials' => array('partials/myBigAngularModule'),
    'requires' => array('otherModuleA', 'otherModuleB'),
    'basePages' => array('civicrm/a'),
  );
}
Return values
null

the return value is ignored

apiWrappers()

This hook is called before running an api call.

public static apiWrappers(array<string|int, API_Wrapper&$wrappers, mixed $apiRequest) : null
Parameters
$wrappers : array<string|int, API_Wrapper>

(see CRM_Utils_API_ReloadOption as an example)

$apiRequest : mixed
Return values
null

The return value is ignored

batchItems()

This hook is called when the entries of the CSV Batch export are mapped.

public static batchItems(array<string|int, mixed> &$results, array<string|int, mixed> &$items) : mixed
Parameters
$results : array<string|int, mixed>
$items : array<string|int, mixed>

batchQuery()

This hook is called when a query string of the CSV Batch export is generated.

public static batchQuery(string &$query) : mixed
Parameters
$query : string

buildAmount()

This hook is called when building the amount structure for a Contribution or Event Page.

public static buildAmount(int $pageType, CRM_Core_Form &$form, array<string|int, mixed> &$amount) : null
Parameters
$pageType : int

Is this a contribution or event page.

$form : CRM_Core_Form

Reference to the form object.

$amount : array<string|int, mixed>

The amount structure to be displayed.

Return values
null

buildAsset()

This hook is called whenever the system builds a new copy of semi-static asset.

public static buildAsset(string $asset, array<string|int, mixed> $params, string &$mimeType, string &$content) : null
Parameters
$asset : string

The name of the asset. Ex: 'angular.json'

$params : array<string|int, mixed>

List of optional arguments which influence the content. Note: Params are immutable because they are part of the cache-key.

$mimeType : string

Initially, NULL. Modify to specify the mime-type.

$content : string

Initially, NULL. Modify to specify the rendered content.

Return values
null

the return value is ignored

buildForm()

This hook is invoked when building a CiviCRM form. This hook should also be used to set the default values of a form element

public static buildForm(string $formName, CRM_Core_Form &$form) : null
Parameters
$formName : string

The name of the form.

$form : CRM_Core_Form

Reference to the form object.

Return values
null

the return value is ignored

buildGroupContactCache()

Build the group contact cache for the relevant group.

public static buildGroupContactCache(array<string|int, mixed> $savedSearch, int $groupID, string &$sql) : void

This hook allows a listener to specify the sql to be used to build a group in the group contact cache.

If sql is altered then the api / bao query methods of building the cache will not be called.

An example of the sql it might be set to is:

SELECT 7 AS group_id, contact_a.id as contact_id FROM civicrm_contact contact_a WHERE contact_a.contact_type = 'Household' AND contact_a.household_name LIKE '%' AND ( 1 ) ORDER BY contact_a.id AND contact_a.id NOT IN ( SELECT contact_id FROM civicrm_group_contact WHERE civicrm_group_contact.status = 'Removed' AND civicrm_group_contact.group_id = 7 )

Parameters
$savedSearch : array<string|int, mixed>
$groupID : int
$sql : string

buildProfile()

This hook is called while preparing a profile form.

public static buildProfile(string $profileName) : mixed
Parameters
$profileName : string

buildStateProvinceForCountry()

This hook is called when building the state list for a particular country.

public static buildStateProvinceForCountry(array<string|int, mixed> $countryID, mixed &$states) : null
Parameters
$countryID : array<string|int, mixed>

The country id whose states are being selected.

$states : mixed
Return values
null

buildUFGroupsForModule()

This hook is called when uf groups are being built for a module.

public static buildUFGroupsForModule(string $moduleName, array<string|int, mixed> &$ufGroups) : null
Parameters
$moduleName : string

Module name.

$ufGroups : array<string|int, mixed>

Array of ufgroups for a module.

Return values
null

caseChange()

This hook fires whenever a record in a case changes.

public static caseChange(Analyzer $analyzer) : mixed
Parameters
$analyzer : Analyzer

A bundle of data about the case (such as the case and activity records).

caseEmailSubjectPatterns()

This hook is called when getting case email subject patterns.

public static caseEmailSubjectPatterns(array<string|int, mixed> &$subjectPatterns) : mixed

All emails related to cases have case hash/id in the subject, e.g: [case #ab12efg] Magic moment [case #1234] Magic is here

Using this hook you can replace/enrich default list with some other patterns, e.g. include case type categories (see CiviCase extension) like: [(case|project|policy initiative) #hash] [(case|project|policy initiative) #id]

Parameters
$subjectPatterns : array<string|int, mixed>

Cases related email subject regexp patterns.

caseSummary()

This hook is called when rendering the Manage Case screen.

public static caseSummary(int $caseID) : array<string|int, mixed>
Parameters
$caseID : int

The case ID.

Return values
array<string|int, mixed>

Array of data to be displayed, where the key is a unique id to be used for styling (div id's) and the value is an array with keys 'label' and 'value' specifying label/value pairs

caseTypes()

This hook is called when locating CiviCase types.

public static caseTypes(array<string|int, mixed> &$caseTypes) : mixed
Parameters
$caseTypes : array<string|int, mixed>

check()

Check system status.

public static check(array<string|int, CRM_Utils_Check_Message&$messages[, array<string|int, mixed> $statusNames = [] ][, bool $includeDisabled = FALSE ]) : mixed
Parameters
$messages : array<string|int, CRM_Utils_Check_Message>

A list of messages regarding system status

$statusNames : array<string|int, mixed> = []

If specified, only these checks are being requested and others should be skipped

$includeDisabled : bool = FALSE

Run checks that have been explicitly disabled (default false)

commonBuildModuleList()

Build the list of modules to be processed for hooks.

public commonBuildModuleList(string $fnPrefix) : mixed
Parameters
$fnPrefix : string

commonInvoke()

public commonInvoke(array<string|int, mixed> $numParams, mixed &$arg1, mixed &$arg2, mixed &$arg3, mixed &$arg4, mixed &$arg5, mixed &$arg6, mixed $fnSuffix, mixed $fnPrefix) : array<string|int, mixed>|bool
Parameters
$numParams : array<string|int, mixed>
$arg1 : mixed
$arg2 : mixed
$arg3 : mixed
$arg4 : mixed
$arg5 : mixed
$arg6 : mixed
$fnSuffix : mixed
$fnPrefix : mixed
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>|bool

config()

You can use this hook to modify the config object and hence behavior of CiviCRM dynamically.

public static config(CRM_Core_Config &$config[, array<string|int, mixed>|null $flags = NULL ]) : mixed

In typical page-loads, this hook fires one time. However, the hook may fire multiple times if...

  • the process is executing test-suites, or
  • the process involves some special configuration-changes, or
  • the process begins with the "extern" bootstrap process (aka loadBootStrap()) N.B. For "extern", CiviCRM initially boots without having access to the UF APIs. When the UF eventually boots, it may re-fire the event (for the benefit UF add-ons).

The possibility of multiple invocations means that most consumers should be guarded. When registering resources, consult the $flags.

function hook_civicrm_config($config, $flags = NULL) { if ($flags['...']) { Civi::dispatcher()->addListener(...); CRM_Core_Smarty::singleton()->addTemplateDir(...); } }

Parameters
$config : CRM_Core_Config

The config object

$flags : array<string|int, mixed>|null = NULL

Mix of flags:

  • civicrm: TRUE if this invocation is intended for CiviCRM extensions
  • uf: TRUE if this invocation is intended for UF modules (Drupal/Joomla/etc)
  • instances: The number of distinct copies of CRM_Core_Config which have been initialized.

The value of $flags is NULL when executing on an older CiviCRM environments (<=5.65).

contactListQuery()

Use this hook to populate the list of contacts returned by Contact Reference custom fields.

public static contactListQuery(mixed &$query, string $queryText, string $context, int $id) : mixed

By default, Contact Reference fields will search on and return all CiviCRM contacts. If you want to limit the contacts returned to a specific group, or some other criteria

  • you can override that behavior by providing a SQL query that returns some subset of your contacts. The hook is called when the query is executed to get the list of contacts to display.
Parameters
$query : mixed
  • the query that will be executed (input and output parameter);. It's important to realize that the ACL clause is built prior to this hook being fired, so your query will ignore any ACL rules that may be defined. Your query must return two columns: the contact 'data' to display in the autocomplete dropdown (usually contact.sort_name - aliased as 'data') the contact IDs
$queryText : string

The name string to execute the query against (this is the value being typed in by the user).

$context : string

The context in which this ajax call is being made (for example: 'customfield', 'caseview').

$id : int

The id of the object for which the call is being made. For custom fields, it will be the custom field id

container()

Modify the CiviCRM container - add new services, parameters, extensions, etc.

public static container(ContainerBuilder $container) : mixed
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\Definition;

function mymodule_civicrm_container($container) {
  $container->addResource(new FileResource(__FILE__));
  $container->setDefinition('mysvc', new Definition('My\Class', array()));
}

Tip: The container configuration will be compiled/cached. The default cache behavior is aggressive. When you first implement the hook, be sure to flush the cache. Additionally, you should relax caching during development. In civicrm.settings.php, set define('CIVICRM_CONTAINER_CACHE', 'auto').

Note: This is a preboot hook. It will dispatch via the extension/module subsystem but not the Symfony EventDispatcher.

Parameters
$container : ContainerBuilder
Tags
see
http://symfony.com/doc/current/components/dependency_injection/index.html

copy()

This hook is called after a copy of an object has been made. The current objects are Event, Contribution Page and UFGroup

public static copy(string $objectName, object &$object[, int $original_id = NULL ]) : null
Parameters
$objectName : string

Name of the object.

$object : object

Reference to the copy.

$original_id : int = NULL

Original entity ID.

Return values
null

coreResourceList()

This hook is called when core resources are being loaded

public static coreResourceList(array<string|int, mixed> &$list, string $region) : mixed
Parameters
$list : array<string|int, mixed>
$region : string
Tags
see
CRM_Core_Resources::coreResourceList

cron()

This hook is called before running pending cron jobs.

public static cron(CRM_Core_JobManager $jobManager) : null
Parameters
$jobManager : CRM_Core_JobManager
Return values
null

The return value is ignored.

crypto()

Register cryptographic resources, such as keys and cipher-suites.

public static crypto(CryptoRegistry $crypto) : mixed

Ex: $crypto->addSymmetricKey([ 'key' => hash_hkdf('sha256', 'abcd1234'), 'suite' => 'aes-cbc-hs', ]);

Parameters
$crypto : CryptoRegistry

cryptoRotateKey()

Rotate the cryptographic key used in the database.

public static cryptoRotateKey(string $tag, LoggerInterface $log) : null

The purpose of this hook is to visit any encrypted values in the database and re-encrypt the content.

For values encoded via CryptoToken, you can use CryptoToken::rekey($oldToken, $tag)

Parameters
$tag : string

The type of crypto-key that is currently being rotated. The hook-implementer should use this to decide which (if any) fields to visit. Ex: 'CRED'

$log : LoggerInterface

List of messages about re-keyed values.

Tags
code

function example_civicrm_rekey($tag, &$log) { if ($tag !== 'CRED') return;

$cryptoToken = Civi::service('crypto.token'); $rows = sql('SELECT id, secret_column FROM some_table'); foreach ($rows as $row) { $new = $cryptoToken->rekey($row['secret_column']); if ($new !== NULL) { sql('UPDATE some_table SET secret_column = %1 WHERE id = %2', $new, $row['id']); } } }

endCode
Return values
null

The return value is ignored

custom()

This hook is called after a db write on a custom table.

public static custom(string $op, int $groupID, int $entityID, array<string|int, mixed> &$params) : null
Parameters
$op : string

The type of operation being performed.

$groupID : int

The custom group ID.

$entityID : int

The entityID of the row in the custom table.

$params : array<string|int, mixed>

The parameters that were sent into the calling function.

Return values
null

the return value is ignored

customPre()

This hook is called before a db write on a custom table.

public static customPre(string $op, int $groupID, int $entityID, array<string|int, mixed> &$params) : null
Parameters
$op : string

The type of operation being performed.

$groupID : int

The custom group ID.

$entityID : int

The entityID of the row in the custom table.

$params : array<string|int, mixed>

The parameters that were sent into the calling function.

Return values
null

the return value is ignored

dashboard()

This hook is called when rendering the dashboard (q=civicrm/dashboard)

public static dashboard(int $contactID[, int &$contentPlacement = self::DASHBOARD_BELOW ]) : string
Parameters
$contactID : int

The contactID for whom the dashboard is being rendered.

$contentPlacement : int = self::DASHBOARD_BELOW

(output parameter) where should the hook content be displayed. relative to the activity list

Return values
string

the html snippet to include in the dashboard

dashboard_defaults()

This hook is called while initializing the default dashlets for a contact dashboard.

public static dashboard_defaults(array<string|int, mixed> $availableDashlets, array<string|int, mixed> &$defaultDashlets) : mixed
Parameters
$availableDashlets : array<string|int, mixed>

List of dashlets; each is formatted per api/v3/Dashboard

$defaultDashlets : array<string|int, mixed>

List of dashlets; each is formatted per api/v3/DashboardContact

disable()

This hook is called when a module-extension is disabled.

public static disable() : mixed

Each module will receive hook_civicrm_disable during its own disablement (but not during the disablement of unrelated modules).

dupeQuery()

This hook allows modification of the queries constructed from dupe rules.

public static dupeQuery(string $obj, string $type, array<string|int, mixed> &$query) : mixed

since 5.72

Parameters
$obj : string

Object of rulegroup class.

$type : string

Type of queries e.g table / threshold.

$query : array<string|int, mixed>

Set of queries.

emailProcessor()

This hook is called AFTER EACH email has been processed by the script bin/EmailProcessor.php

public static emailProcessor(string $type, array<string|int, mixed> &$params, object $mail, array<string|int, mixed> &$result[, string $action = NULL ][, int|null $mailSettingId = NULL ]) : mixed
Parameters
$type : string

Type of mail processed: 'activity' OR 'mailing'.

$params : array<string|int, mixed>

the params that were sent to the CiviCRM API function

$mail : object

The mail object which is an ezcMail class.

$result : array<string|int, mixed>

the result returned by the api call

$action : string = NULL

(optional ) the requested action to be performed if the types was 'mailing'.

$mailSettingId : int|null = NULL

The MailSetting ID the email relates to

emailProcessorContact()

This hook is called when we are determining the contactID for a specific email address

public static emailProcessorContact(string $email, int $contactID, array<string|int, mixed> &$result) : null
Parameters
$email : string

The email address.

$contactID : int

The contactID that matches this email address, IF it exists.

$result : array<string|int, mixed>

(reference) has two fields. contactID - the new (or same) contactID action - 3 possible values: CRM_Utils_Mail_Incoming::EMAILPROCESSOR_CREATE_INDIVIDUAL - create a new contact record CRM_Utils_Mail_Incoming::EMAILPROCESSOR_OVERRIDE - use the new contactID CRM_Utils_Mail_Incoming::EMAILPROCESSOR_IGNORE - skip this email address

Return values
null

enable()

This hook is called when a module-extension is re-enabled.

public static enable() : mixed

Each module will receive hook_civicrm_enable during its own re-enablement (but not during the re-enablement of unrelated modules).

entityRefFilters()

Allows the list of filters on the EntityRef widget to be altered.

public static entityRefFilters(array<string|int, mixed> &$filters[, array<string|int, mixed> &$links = NULL ]) : mixed
Parameters
$filters : array<string|int, mixed>
$links : array<string|int, mixed> = NULL
Tags
see
CRM_Core_Resources::entityRefFilters

entityTypes()

This hook is called for declaring entities.

public static entityTypes(array<string|int, array<string|int, mixed>> &$entityTypes) : null

Note: This is a pre-boot hook. It will dispatch via the extension/module subsystem but not the Symfony EventDispatcher.

Parameters
$entityTypes : array<string|int, array<string|int, mixed>>

List of entity definitions; each item is keyed by entity name. Each entity-type is an array with values:

  • name: string, a unique short name (e.g. "ReportInstance")
  • module: string, full_name of extension declaring the entity (e.g. "search_kit")
  • class: string|null, a PHP DAO class (e.g. "CRM_Report_DAO_Instance")
  • table: string|null, a SQL table name (e.g. "civicrm_report_instance")

Other possible values in the entity definition array are documented here:

Tags
see
https://docs.civicrm.org/dev/en/latest/framework/entities/
Return values
null

The return value is ignored

esmImportMap()

Build a list of ECMAScript Modules (ESM's) that are available for auto-loading.

public static esmImportMap(ImportMap $importMap) : void

Subscribers should assume that the $importMap will be cached and re-used.

Example usage:

function my_civicrm_esmImportMap($importMap): void { $importMap->addPrefix('geolib/', E::LONG_NAME, 'packages/geometry-library-1.2.3/'); }

Parameters
$importMap : ImportMap

eventDiscount()

public static eventDiscount(mixed &$form, array<string|int, mixed> &$params) : mixed
Parameters
$form : mixed
$params : array<string|int, mixed>

export()

This hook is called before record is exported as CSV.

public static export(string &$exportTempTable, array<string|int, mixed> &$headerRows, array<string|int, mixed> &$sqlColumns, int $exportMode, string $componentTable, array<string|int, mixed> $ids) : mixed
Parameters
$exportTempTable : string

Name of the temporary export table used during export.

$headerRows : array<string|int, mixed>

Header rows for output.

$sqlColumns : array<string|int, mixed>

SQL columns.

$exportMode : int

Export mode ( contact, contribution, etc...).

$componentTable : string

Name of temporary table

$ids : array<string|int, mixed>

Array of object's ids

fieldOptions()

Hook for modifying field options

public static fieldOptions(string $entity, string $field, array<string|int, mixed> &$options, array<string|int, mixed> $params) : mixed
Parameters
$entity : string
$field : string
$options : array<string|int, mixed>
$params : array<string|int, mixed>

fileSearches()

public static fileSearches(array<string|int, mixed> &$fileSearches) : mixed
Parameters
$fileSearches : array<string|int, mixed>

CRM_Core_FileSearchInterface

findDuplicates()

Check for duplicate contacts

public static findDuplicates(array<string|int, mixed> $dedupeParams, array<string|int, mixed> &$dedupeResults, array<string|int, mixed> $contextParams) : mixed
Parameters
$dedupeParams : array<string|int, mixed>

Array of params for finding duplicates: [ '{parameters returned by CRM_Dedupe_Finder::formatParams} 'check_permission' => TRUE/FALSE; 'contact_type' => $contactType; 'rule' = $rule; 'rule_group_id' => $ruleGroupID; 'excludedContactIDs' => $excludedContactIDs;

$dedupeResults : array<string|int, mixed>

Array of results ['handled' => TRUE/FALSE, 'ids' => array of IDs of duplicate contacts]

$contextParams : array<string|int, mixed>

The context if relevant, eg. ['event_id' => X]

geocoderFormat()

This hook is called when a geocoder's format method is called.

public static geocoderFormat(string $geoProvider, array<string|int, mixed> &$values, SimpleXMLElement $xml) : mixed
Parameters
$geoProvider : string
$values : array<string|int, mixed>
$xml : SimpleXMLElement

getAssetUrl()

This hook is called when building a link to a semi-static asset.

public static getAssetUrl(string &$asset, array<string|int, mixed> &$params) : null
Parameters
$asset : string

The name of the asset. Ex: 'angular.json'

$params : array<string|int, mixed>

List of optional arguments which influence the content.

Return values
null

the return value is ignored

idsException()

This hook is called for bypass a few civicrm urls from IDS check.

public static idsException(array<string|int, mixed> &$skip) : mixed
Parameters
$skip : array<string|int, mixed>

list of civicrm urls

import()

This hook is called after a row has been processed and the record (and associated records imported

public static import(string $object, string $usage, string &$objectRef, array<string|int, mixed> &$params) : mixed
Parameters
$object : string

Object being imported (for now Contact only, later Contribution, Activity,. Participant and Member)

$usage : string

Hook usage/location (for now process only, later mapping and others).

$objectRef : string

Import record object.

$params : array<string|int, mixed>

Array with various key values: currently. contactID - contact id importID - row id in temp table importTempTable - name of tempTable fieldHeaders - field headers fields - import fields

importAlterMappedRow()

Alter import mappings.

public static importAlterMappedRow(string $importType, string $context, array<string|int, mixed> &$mappedRow, array<string|int, mixed> $rowValues, int $userJobID) : mixed
Parameters
$importType : string

This corresponds to the value in civicrm_user_job.job_type.

$context : string

import or validate. In validate context only 'cheap' lookups should be done (e.g. using cached information). Validate is intended to quickly process a whole file for errors. You should focus on setting or unsetting key values to or from 'invalid_import_value'.

During import mode heavier lookups can be done (e.g using custom logic to find the relevant contact) as this is then passed to the api functions. If a row is invalid during import mode you should throw an exception.

$mappedRow : array<string|int, mixed>

(reference) The rows that have been mapped to an array of params.

$rowValues : array<string|int, mixed>

The row from the data source (non-associative array)

$userJobID : int

id from civicrm_user_job

inboundSMS()

This hook is called before an inbound SMS is processed.

public static inboundSMS(CRM_SMS_Message &$message) : mixed
Parameters
$message : CRM_SMS_Message

An SMS message received

install()

Run early installation steps for an extension. Ex: Create new MySQL table.

public static install() : mixed

This dispatches directly to each new extension. You will only receive notices for your own installation.

If multiple extensions are installed simultaneously, they will all run hook_install/hook_enable back-to-back (in order of dependency).

This runs BEFORE refreshing major caches and services (such as ManagedEntities and CRM_Logging_Schema).

Tags
see
https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install

invalidateChecksum()

Allows an extension to override the checksum validation.

public static invalidateChecksum(int $contactID, string $checksum, bool &$invalid) : mixed

For example you may want to invalidate checksums that were sent out/forwarded by mistake. You could also intercept and redirect to a different page in this case - eg. to say "sorry, you tried to use a compromised checksum".

Parameters
$contactID : int
$checksum : string
$invalid : bool

Leave this at FALSE to allow the core code to perform validation. Set to TRUE to invalidate

invoke()

Invoke a hook.

public invoke(array<string|int, mixed> $names, mixed &$arg1, mixed &$arg2, mixed &$arg3, mixed &$arg4, mixed &$arg5, mixed &$arg6, mixed $fnSuffix) : mixed

This is a transitional adapter. It supports the legacy syntax but also accepts enough information to support Symfony Event dispatching.

Parameters
$names : array<string|int, mixed>

(Recommended) Array of parameter names, in order. Using an array is recommended because it enables full event-broadcasting behaviors. (Legacy) Number of parameters to pass to the hook. This is provided for transitional purposes.

$arg1 : mixed
$arg2 : mixed
$arg3 : mixed
$arg4 : mixed
$arg5 : mixed
$arg6 : mixed
$fnSuffix : mixed

invokeViaUF()

Invoke a hook through the UF/CMS hook system and the extension-hook system.

public invokeViaUF(int $numParams, mixed &$arg1, mixed &$arg2, mixed &$arg3, mixed &$arg4, mixed &$arg5, mixed &$arg6, string $fnSuffix) : mixed
Parameters
$numParams : int
$arg1 : mixed
$arg2 : mixed
$arg3 : mixed
$arg4 : mixed
$arg5 : mixed
$arg6 : mixed
$fnSuffix : string

This hook retrieves links from other modules and injects it into.

public static links(string $op, string $objectName, int $objectId, array<string|int, mixed> &$links[, int|null &$mask = NULL ][, array<string|int, mixed> &$values = [] ]) : null

the view contact tabs

Parameters
$op : string

The type of operation being performed.

$objectName : string

The name of the object. This is generally a CamelCase entity (eg Contact or Activity). Historical exceptions: 'CRM_Core_BAO_LocationType', 'CRM_Core_BAO_MessageTemplate'

$objectId : int

The unique identifier for the object.

$links : array<string|int, mixed>

(optional) the links array (introduced in v3.2). Each of the links may have properties:

Depending on the specific screen, some fields (e.g. icon) may be ignored. If you have any idea of a clearer rule, then please update the docs.

$mask : int|null = NULL

(optional) the bitmask to show/hide links.

$values : array<string|int, mixed> = []

(optional) the values to fill the links.

Return values
null

the return value is ignored

mailingGroups()

This hook is called when composing a mailing. You can include / exclude other groups as needed.

public static mailingGroups(mixed &$form, array<string|int, mixed> &$groups, array<string|int, mixed> &$mailings) : mixed
Parameters
$form : mixed

The form object for which groups / mailings being displayed

$groups : array<string|int, mixed>

The list of groups being included / excluded

$mailings : array<string|int, mixed>

The list of mailings being included / excluded

mailingTemplateTypes()

Modify the list of template-types used for CiviMail composition.

public static mailingTemplateTypes(array<string|int, mixed> &$types) : mixed
Parameters
$types : array<string|int, mixed>

Sequentially indexed list of template types. Each type specifies:

  • name: string
  • editorUrl: string, Angular template URL
  • weight: int, priority when picking a default value for new mailings

mailSetupActions()

When adding a new "Mail Account" (`MailSettings`), present a menu of setup options.

public static mailSetupActions(array<string|int, mixed> &$setupActions) : mixed
Parameters
$setupActions : array<string|int, mixed>

Each item has a symbolic-key, and it has the properties:

  • title: string
  • callback: string|array, the function which starts the setup process. The function is expected to return a 'url' for the config screen.
  • url: string (optional), a URL which starts the setup process. If omitted, then a default URL is generated. The effect of opening the URL is to invoke the callback.

managed()

This hook is called for declaring managed entities via API.

public static managed(array<string|int, mixed> &$entities[, array<string|int, mixed>|null $modules = NULL ]) : null
Parameters
$entities : array<string|int, mixed>

List of pending entities. Each entity is an array with keys:

  • 'module': string; for module-extensions, this is the fully-qualifed name (e.g. "com.example.mymodule"); for CMS modules, the name is prefixed by the CMS (e.g. "drupal.mymodule")
  • 'name': string, a symbolic name which can be used to track this entity (Note: Each module creates its own namespace)
  • 'entity': string, an entity-type supported by the CiviCRM API (Note: this currently must be an entity which supports the 'is_active' property)
  • 'params': array, the entity data as supported by the CiviCRM API
  • 'update' (v4.5+): string, a policy which describes when to update records
    • 'always' (default): always update the managed-entity record; changes in $entities will override any local changes (eg by the site-admin)
    • 'never': never update the managed-entity record; changes made locally (eg by the site-admin) will override changes in $entities
  • 'cleanup' (v4.5+): string, a policy which describes whether to cleanup the record when it becomes orphaned (ie when $entities no longer references the record)
    • 'always' (default): always delete orphaned records
    • 'never': never delete orphaned records
    • 'unused': only delete orphaned records if there are no other references to it in the DB. (This is determined by calling the API's "getrefcount" action.)
$modules : array<string|int, mixed>|null = NULL

(Added circa v5.50) If given, only report entities related to $modules. NULL is a wildcard ("all modules").

This parameter is advisory and is not supplied on older versions. Listeners SHOULD self-censor (only report entities which match the filter). However, all pre-existing listeners were unaware of this option, and they WILL over-report. Over-reported data will be discarded.

Tags
code

// Example: Optimal skeleton for backward/forward compatibility function example_civicrm_managed(&$entities, ?array $modules = NULL) { if ($modules !== NULL && !in_array(E::LONG_NAME, $modules, TRUE)) { return; } $entities[] = [ 'module' => E::LONG_NAME, 'name' => 'my_option_value', 'entity' => 'OptionValue', 'params' => [...], ]; }

endCode
Return values
null

the return value is ignored

membershipTypeValues()

This hook is called when composing the array of membershipTypes and their cost during a membership registration (new or renewal).

public static membershipTypeValues(mixed &$form, array<string|int, mixed> &$membershipTypes) : mixed

Note the hook is called on initial page load and also reloaded after submit (PRG pattern). You can use it to alter the membership types when first loaded, or after submission (for example if you want to gather data in the form and use it to alter the fees).

Parameters
$form : mixed

The form object that is presenting the page

$membershipTypes : array<string|int, mixed>

The array of membership types and their amount

merge()

This hook allows modification of the data used to perform merging of duplicates.

public static merge(string $type, array<string|int, mixed> &$data[, int $mainId = NULL ][, int $otherId = NULL ][, array<string|int, mixed> $tables = NULL ]) : mixed
Parameters
$type : string

The type of data being passed (cidRefs|eidRefs|relTables|sqls).

$data : array<string|int, mixed>

The data, as described in $type.

$mainId : int = NULL

Contact_id of the contact that survives the merge.

$otherId : int = NULL

Contact_id of the contact that will be absorbed and deleted.

$tables : array<string|int, mixed> = NULL

When $type is "sqls", an array of tables as it may have been handed to the calling function.

navigationMenu()

This hook allows modification of the navigation menu.

public static navigationMenu(array<string|int, mixed> &$params) : mixed
Parameters
$params : array<string|int, mixed>

Associated array of navigation menu entry to Modify/Add

notePrivacy()

Deprecated: use hook_civicrm_selectWhereClause instead.

public static notePrivacy(array<string|int, mixed> &$noteValues) : mixed

since 5.67 will be removed around 5.85 .

Parameters
$noteValues : array<string|int, mixed>

optionValues()

This hooks allows to change option values.

public static optionValues(array<string|int, mixed> &$options, string $groupName) : mixed

in favor of hook_civicrm_fieldOptions

Parameters
$options : array<string|int, mixed>

Associated array of option values / id

$groupName : string

Option group name

pageRun()

This hook is called before a CiviCRM Page is rendered. You can use this hook to insert smarty variables in a template

public static pageRun(object &$page) : null
Parameters
$page : object

The page that will be rendered.

Return values
null

permission()

This hook is called when exporting Civi's permission to the CMS. Use this hook to modify the array of system permissions for CiviCRM.

public static permission(array<string|int, mixed> &$newPermissions) : null
Parameters
$newPermissions : array<string|int, mixed>

Array to be filled with permissions.

Tags
throws
RuntimeException
Return values
null

The return value is ignored

permission_check()

This hook is called when checking permissions; use this hook to dynamically escalate user permissions in certain use cases (cf. CRM-19256).

public static permission_check(string $permission, bool &$granted, int $contactId) : null
Parameters
$permission : string

The name of an atomic permission, ie. 'access deleted contacts'

$granted : bool

Whether this permission is currently granted. The hook can change this value.

$contactId : int

Contact whose permissions we are checking (if null, assume current user).

Return values
null

The return value is ignored

permissionList()

This hook is used to enumerate the list of available permissions. It may include concrete permissions defined by Civi, concrete permissions defined by the CMS, and/or synthetic permissions.

public static permissionList(array<string|int, mixed> &$permissions) : null
Parameters
$permissions : array<string|int, mixed>

Array of permissions, keyed by symbolic name. Each is an array with fields:

  • group: string (ex: "civicrm", "cms")
  • title: string (ex: "CiviEvent: Register for events")
  • description: string (ex: "Register for events online")
  • is_synthetic: bool (TRUE for synthetic permissions with a bespoke evaluation. FALSE for concrete permissions that registered+granted in the UF user-management layer. Default TRUE iff name begins with '@')
  • is_active: bool (FALSE for permissions belonging to disabled components, TRUE otherwise)
Tags
see
Permission::get()
Return values
null

The return value is ignored

post()

This hook is called after a db write on some core objects.

public static post(string $op, string $objectName, int $objectId[, object &$objectRef = NULL ][, array<string|int, mixed> $params = NULL ]) : mixed
Parameters
$op : string

The type of operation being performed.

$objectName : string

The name of the object.

$objectId : int

The unique identifier for the object.

$objectRef : object = NULL

The reference to the object if available.

$params : array<string|int, mixed> = NULL

Original params used, if available

Return values
mixed

based on op. pre-hooks return a boolean or an error message which aborts the operation

post_case_merge()

This hook is called after a case merge (or a case reassign)

public static post_case_merge(int $mainContactId[, int $mainCaseId = NULL ][, int $otherContactId = NULL ][, int $otherCaseId = NULL ][, bool $changeClient = FALSE ]) : mixed
Parameters
$mainContactId : int
$mainCaseId : int = NULL
$otherContactId : int = NULL
$otherCaseId : int = NULL
$changeClient : bool = FALSE

postCommit()

This hook is equivalent to post(), except that it is guaranteed to run outside of any SQL transaction. The objectRef is not modifiable.

public static postCommit(string $op, string $objectName, int $objectId[, object $objectRef = NULL ]) : mixed

This hook is defined for two cases:

  1. If the original action runs within a transaction, then the hook fires after the transaction commits.
  2. If the original action runs outside a transaction, then the data was committed immediately, and we can run the hook immediately.
Parameters
$op : string

The type of operation being performed.

$objectName : string

The name of the object.

$objectId : int

The unique identifier for the object.

$objectRef : object = NULL

The reference to the object if available.

Return values
mixed

based on op. pre-hooks return a boolean or an error message which aborts the operation

postEmailSend()

This hook is called when an email has been successfully sent by CiviCRM, but not on an error.

public static postEmailSend(array<string|int, mixed> &$params) : mixed
Parameters
$params : array<string|int, mixed>

The mailing parameters. Array fields include: groupName, from, toName, toEmail, subject, cc, bcc, text, html, returnPath, replyTo, headers, attachments (array)

postInstall()

Run later installation steps. Ex: Call a bespoke API-job for the first time.

public static postInstall() : mixed

This dispatches directly to each new extension. You will only receive notices for your own installation.

If multiple extensions are installed simultaneously, they will all run hook_postInstall back-to-back (in order of dependency).

This runs AFTER refreshing major caches and services (such as ManagedEntities and CRM_Logging_Schema).

Tags
see
https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall

postIPNProcess()

Allow Extensions to custom process IPN hook data such as sending Google Analytics information based on the IPN

public static postIPNProcess(array<string|int, mixed> &$IPNData) : mixed
Parameters
$IPNData : array<string|int, mixed>
  • Array of IPN Data

postJob()

This hook is called after a scheduled job is executed

public static postJob(CRM_Core_DAO_Job $job, array<string|int, mixed> $params, array<string|int, mixed> $result) : mixed
Parameters
$job : CRM_Core_DAO_Job

The job that was executed

$params : array<string|int, mixed>

The arguments given to the job

$result : array<string|int, mixed>

The result of the API call, or the thrown exception if any

postMailing()

This hook is called when a CiviMail mailing has completed

public static postMailing(int $mailingId) : mixed
Parameters
$mailingId : int

Mailing ID

postProcess()

This hook is invoked when a CiviCRM form is submitted. If the module has injected any form elements, this hook should save the values in the database

public static postProcess(string $formName, CRM_Core_Form &$form) : null
Parameters
$formName : string

The name of the form.

$form : CRM_Core_Form

Reference to the form object.

Return values
null

the return value is ignored

pre()

This hook is called before a db write on some core objects.

public static pre(string $op, string $objectName, int|null $id[, array<string|int, mixed> &$params = [] ]) : null

This hook does not allow the abort of the operation

Parameters
$op : string

The type of operation being performed.

$objectName : string

The name of the object.

$id : int|null

The object id if available.

$params : array<string|int, mixed> = []

The parameters used for object creation / editing.

Return values
null

the return value is ignored

pre_case_merge()

This hook is called before a case merge (or a case reassign)

public static pre_case_merge(int $mainContactId[, int $mainCaseId = NULL ][, int $otherContactId = NULL ][, int $otherCaseId = NULL ][, bool $changeClient = FALSE ]) : mixed
Parameters
$mainContactId : int
$mainCaseId : int = NULL
$otherContactId : int = NULL
$otherCaseId : int = NULL
$changeClient : bool = FALSE

preJob()

This hook is called before a scheduled job is executed

public static preJob(CRM_Core_DAO_Job $job, array<string|int, mixed> $params) : mixed
Parameters
$job : CRM_Core_DAO_Job

The job to be executed

$params : array<string|int, mixed>

The arguments to be given to the job

preProcess()

This hook is invoked during the CiviCRM form preProcess phase.

public static preProcess(string $formName, CRM_Core_Form &$form) : null
Parameters
$formName : string

The name of the form.

$form : CRM_Core_Form

Reference to the form object.

Return values
null

the return value is ignored

processProfile()

This hook is called processing a valid profile form submission.

public static processProfile(string $profileName) : mixed
Parameters
$profileName : string

queryObjects()

This hook is called while building the core search query, so hook implementers can provide their own query objects which alters/extends core search.

public static queryObjects(array<string|int, mixed> &$queryObjects[, string $type = 'Contact' ]) : mixed
Parameters
$queryObjects : array<string|int, mixed>
$type : string = 'Contact'

queueActive()

Should queue processing proceed.

public static queueActive(string &$status, string $queueName, array<string|int, mixed> $queueSpecification) : void

This hook is called when a background process attempts to claim an item from the queue to process. A hook could alter the status from 'active' to denote that the server is busy & hence no item should be claimed and processed at this time.

Parameters
$status : string

This will be set to active. It is recommended hooks change it to 'paused' to prevent queue processing (although currently any value other than active is treated as inactive 'paused')

$queueName : string

The name of the queue. Equivalent to civicrm_queue.name

$queueSpecification : array<string|int, mixed>

Array of information about the queue loaded from civicrm_queue.

Tags
see
https://docs.civicrm.org/dev/en/latest/framework/queues/

queueRun()

Fire `hook_civicrm_queueRun_{$runner}`.

public static queueRun(CRM_Queue_Queue $queue, array<string|int, mixed> $items, array<string|int, mixed> &$outcomes) : mixed

This event only fires if these conditions are met:

  1. The $queue has been persisted in civicrm_queue.
  2. The $queue has a runner property.
  3. The $queue has some pending tasks.
  4. The system has a queue-running agent.
Parameters
$queue : CRM_Queue_Queue
$items : array<string|int, mixed>

List of claimed items which we may evaluate.

$outcomes : array<string|int, mixed>

The outcomes of each task. One of 'ok', 'retry', 'fail'. Keys should match the keys in $items.

Tags
throws
CRM_Core_Exception

queueStatus()

Fired if the status of a queue changes.

public static queueStatus(CRM_Queue_Queue $queue, string $status) : void
Parameters
$queue : CRM_Queue_Queue
$status : string

New status. Ex: 'completed', 'active', 'aborted'

queueTaskError()

This is called if automatic execution of a queue-task fails.

public static queueTaskError(CRM_Queue_Queue $queue, CRM_Queue_DAO_QueueItem|stdClass $item, string &$outcome, Throwable|null $exception) : mixed

The $outcome may be modified. For example, you might inspect the $item and $exception -- and then decide whether to 'retry', 'delete', or 'abort'.

Parameters
$queue : CRM_Queue_Queue
$item : CRM_Queue_DAO_QueueItem|stdClass

The enqueued item $item. In principle, this is the $item format determined by the queue, which includes id and data. In practice, it is typically an instance of CRM_Queue_DAO_QueueItem.

$outcome : string

The outcome of the task. Legal values:

  • 'retry': The task encountered a problem, and it should be retried.
  • 'delete': The task encountered a non-recoverable problem, and it should be deleted.
  • 'abort': The task encountered a non-recoverable problem, and the queue should be stopped.
  • 'ok': The task finished normally. (You won't generally see this, but it could be useful in some customizations.) The default outcome for task-errors is determined by the queue settings (civicrm_queue.error).
$exception : Throwable|null

If the task failed, this is the cause of the failure.

recent()

This hook is called before storing recently viewed items.

public static recent(array<string|int, mixed> &$recentArray) : array<string|int, mixed>
Parameters
$recentArray : array<string|int, mixed>

An array of recently viewed or processed items, for in place modification.

Return values
array<string|int, mixed>

referenceCounts()

Determine how many other records refer to a given record.

public static referenceCounts(CRM_Core_DAO $dao, array<string|int, mixed> &$refCounts) : mixed
Parameters
$dao : CRM_Core_DAO

The item for which we want a reference count.

$refCounts : array<string|int, mixed>

Each item in the array is an Array with keys:

  • name: string, eg "sql:civicrm_email:contact_id"
  • type: string, eg "sql"
  • count: int, eg "5" if there are 5 email addresses that refer to $dao
Return values
mixed

Return is not really intended to be used.

requireCiviModules()

public requireCiviModules(mixed &$moduleList) : mixed
Parameters
$moduleList : mixed

runHooks()

Run hooks.

public runHooks(array<string|int, mixed> $civiModules, string $fnSuffix, int $numParams, mixed &$arg1, mixed &$arg2, mixed &$arg3, mixed &$arg4, mixed &$arg5, mixed &$arg6) : array<string|int, mixed>|bool
Parameters
$civiModules : array<string|int, mixed>
$fnSuffix : string
$numParams : int
$arg1 : mixed
$arg2 : mixed
$arg3 : mixed
$arg4 : mixed
$arg5 : mixed
$arg6 : mixed
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>|bool

scanClasses()

Scan extensions for a list of auto-registered interfaces.

public static scanClasses(array<string|int, string> &$classes) : mixed
Parameters
$classes : array<string|int, string>

List of classes which may be of interest to the class-scanner.

Tags
see

mixin/scan-classes@1

searchColumns()

This hook is called from CRM_Core_Selector_Controller through which all searches in civicrm go.

public static searchColumns(string $objectName, array<string|int, mixed> &$headers, array<string|int, mixed> &$rows, array<string|int, mixed> &$selector) : mixed

This enables us hook implementors to modify both the headers and the rows

The BIGGEST drawback with this hook is that you may need to modify the result template to include your fields. The result files are CRM/{Contact,Contribute,Member,Event...}/Form/Selector.tpl

However, if you use the same number of columns, you can overwrite the existing columns with the values that you want displayed. This is a hackish, but avoids template modification.

Parameters
$objectName : string

The component name that we are doing the search. activity, campaign, case, contact, contribution, event, grant, membership, and pledge

$headers : array<string|int, mixed>

the list of column headers, an associative array with keys: ( name, sort, order )

$rows : array<string|int, mixed>

the list of values, an associate array with fields that are displayed for that component

$selector : array<string|int, mixed>

the selector object. Allows you access to the context of the search

Return values
mixed

modify the header and values object to pass the data you need

searchProfile()

This hook is called while preparing a list of contacts (based on a profile)

public static searchProfile(string $profileName) : mixed
Parameters
$profileName : string

searchTasks()

This hook is called to display the list of actions allowed after doing a search.

public static searchTasks(string $objectType, array<string|int, mixed> &$tasks) : mixed

This allows the module developer to inject additional actions or to remove existing actions.

Parameters
$objectType : string

The object type for this search.

  • activity, campaign, case, contact, contribution, event, grant, membership, and pledge are supported.
$tasks : array<string|int, mixed>

The current set of tasks for that custom field. You can add/remove existing tasks. Each task needs to have a title (eg 'title' => ts( 'Group - add contacts')) and a class (eg 'class' => 'CRM_Contact_Form_Task_AddToGroup'). Optional result (boolean) may also be provided. Class can be an array of classes (not sure what that does :( ). The key for new Task(s) should not conflict with the keys for core tasks of that $objectType, which can be found in CRM/$objectType/Task.php.

selectWhereClause()

public static selectWhereClause(string|CRM_Core_DAO $entity, array<string|int, mixed> &$clauses[, int|null $userId = NULL ][, array<string|int, mixed> $conditions = [] ]) : void
Parameters
$entity : string|CRM_Core_DAO
$clauses : array<string|int, mixed>
$userId : int|null = NULL

User contact id. NULL == current user.

$conditions : array<string|int, mixed> = []

Values from WHERE or ON clause

singleton()

Constructor and getter for the singleton instance.

public static singleton([bool $fresh = FALSE ]) : CRM_Utils_Hook
Parameters
$fresh : bool = FALSE
Return values
CRM_Utils_Hook

An instance of $config->userHookClass

summary()

This hook is called when rendering the contact summary.

public static summary(int $contactID, mixed &$content[, int &$contentPlacement = self::SUMMARY_BELOW ]) : string
Parameters
$contactID : int

The contactID for whom the summary is being rendered

$content : mixed
$contentPlacement : int = self::SUMMARY_BELOW

Specifies where the hook content should be displayed relative to the existing content

Return values
string

The html snippet to include in the contact summary

summaryActions()

This hook allows user to customize context menu Actions on contact summary page.

public static summaryActions(array<string|int, mixed> &$actions[, int $contactID = NULL ]) : mixed
Parameters
$actions : array<string|int, mixed>

Array of all Actions in contextmenu.

$contactID : int = NULL

ContactID for the summary page.

tabset()

This hook is called when rendering the tabs used for events and potentially contribution pages, etc.

public static tabset(string $tabsetName, array<string|int, mixed> &$tabs, array<string|int, mixed> $context) : null
Parameters
$tabsetName : string

Name of the screen or visual element.

$tabs : array<string|int, mixed>

Tabs that will be displayed.

$context : array<string|int, mixed>

Extra data about the screen or context in which the tab is used.

Return values
null

themes()

A theme is a set of CSS files which are loaded on CiviCRM pages. To register a new theme, add it to the $themes array. Use these properties:

public static themes(array<string|int, mixed> &$themes) : null
  • ext: string (required) The full name of the extension which defines the theme. Ex: "org.civicrm.themes.greenwich".
  • title: string (required) Visible title.
  • help: string (optional) Description of the theme's appearance.
  • url_callback: mixed (optional) A function ($themes, $themeKey, $cssExt, $cssFile) which returns the URL(s) for a CSS resource. Returns either an array of URLs or PASSTHRU. Ex: \Civi\Core\Themes\Resolvers::simple (default) Ex: \Civi\Core\Themes\Resolvers::none
  • prefix: string (optional) A prefix within the extension folder to prepend to the file name.
  • search_order: array (optional) A list of themes to search. Generally, the last theme should be "fallback" (Civi\Core\Themes::FALLBACK).
  • excludes: array (optional) A list of files (eg "civicrm:css/bootstrap.css" or "$ext:$file") which should never be returned (they are excluded from display).
Parameters
$themes : array<string|int, mixed>

List of themes, keyed by name.

Return values
null

the return value is ignored

tokens()

This hook is called when sending an email / printing labels

public static tokens(array<string|int, mixed> &$tokens[, bool $squashDeprecation = FALSE ]) : null
Parameters
$tokens : array<string|int, mixed>

The list of tokens that can be used for the contact.

$squashDeprecation : bool = FALSE

Suppress the deprecation message - this should ONLY EVER BE CALLED from the backward compatibilty adapter in evaluateLegacyHookTokens. We are deprecating both this function, and the implementation of the hook but for now we ensure that the hook is still rendered for sites that implement it, via the TokenProcessor methodology https://docs.civicrm.org/dev/en/latest/framework/token/#compose-batch

Return values
null

tokenValues()

This hook is called when sending an email / printing labels to get the values for all the tokens returned by the 'tokens' hook

public static tokenValues(array<string|int, mixed> &$details, array<string|int, mixed> $contactIDs[, null $jobID = NULL ][, array<string|int, mixed> $tokens = [] ][, null $className = NULL ][, bool $squashDeprecation = FALSE ]) : null

since 5.71 will be removed sometime after all core uses are fully removed.

Parameters
$details : array<string|int, mixed>

The array to store the token values indexed by contactIDs.

$contactIDs : array<string|int, mixed>

An array of contactIDs.

$jobID : null = NULL

The jobID if this is associated with a CiviMail mailing.

$tokens : array<string|int, mixed> = []

The list of tokens associated with the content.

$className : null = NULL

The top level className from where the hook is invoked.

$squashDeprecation : bool = FALSE

Suppress the deprecation message - this should ONLY EVER BE CALLED from the backward compatibilty adapter in evaluateLegacyHookTokens. We are deprecating both this function, and the implementation of the hook but for now we ensure that the hook is still rendered for sites that implement it, via the TokenProcessor methodology https://docs.civicrm.org/dev/en/latest/framework/token/#compose-batch

Return values
null

translateFields()

Define the list of fields supported in APIv4 data-translation.

public static translateFields(array<string|int, mixed> &$fields) : mixed
Parameters
$fields : array<string|int, mixed>

List of data fields to translate, organized by table and column. Omitted/unlisted fields are not translated. Any listed field may be translated. Values should be TRUE. Ex: $fields['civicrm_event']['summary'] = TRUE

uninstall()

This hook is called when a module-extension is uninstalled.

public static uninstall() : mixed

Each module will receive hook_civicrm_uninstall during its own uninstallation (but not during the uninstallation of unrelated modules).

unsubscribeGroups()

This hook is called when a contact unsubscribes from a mailing. It allows modules to override what the contacts are removed from.

public static unsubscribeGroups(string $op, int $mailingId, int $contactId, array<string|int, mixed>|int &$groups, array<string|int, mixed>|int &$baseGroups) : mixed
Parameters
$op : string

Ignored for now

$mailingId : int

The id of the mailing to unsub from

$contactId : int

The id of the contact who is unsubscribing

$groups : array<string|int, mixed>|int

Groups the contact will be removed from.

$baseGroups : array<string|int, mixed>|int

Base groups (used in smart mailings) the contact will be removed from.

upgrade()

This hook is called to drive database upgrades for extension-modules.

public static upgrade(string $op[, CRM_Queue_Queue|null $queue = NULL ]) : bool|null
Parameters
$op : string

The type of operation being performed; 'check' or 'enqueue'.

$queue : CRM_Queue_Queue|null = NULL

(for 'enqueue') the modifiable list of pending up upgrade tasks.

Return values
bool|null

NULL, if $op is 'enqueue'. TRUE, if $op is 'check' and upgrades are pending. FALSE, if $op is 'check' and upgrades are not pending.

validateForm()

This hook is invoked during all CiviCRM form validation. An array of errors detected is returned. Else we assume validation succeeded.

public static validateForm(string $formName, array<string|int, mixed> &$fields, array<string|int, mixed> &$files, CRM_Core_Form &$form, array<string|int, mixed> &$errors) : mixed
Parameters
$formName : string

The name of the form.

$fields : array<string|int, mixed>

the POST parameters as filtered by QF

$files : array<string|int, mixed>

the FILES parameters as sent in by POST

$form : CRM_Core_Form

the form object

$errors : array<string|int, mixed>

the array of errors.

Return values
mixed

formRule hooks return a boolean or an array of error messages which display a QF Error

validateProfile()

This hook is called while validating a profile form submission.

public static validateProfile(string $profileName) : mixed
Parameters
$profileName : string

viewProfile()

This hook is called while preparing a read-only profile screen

public static viewProfile(string $profileName) : mixed
Parameters
$profileName : string

xmlMenu()

This hook is called when building the menu table.

public static xmlMenu(array<string|int, mixed> &$files) : null
Parameters
$files : array<string|int, mixed>

The current set of files to process.

Return values
null

the return value is ignored


        
On this page

Search results