| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* $Id: $
*
*/
-
abstract class CRM_Utils_Hook {
// Allowed values for dashboard hook content placement
* pattern and cache the instance in this variable
*
* @var object
- * @static
*/
static private $_singleton = NULL;
*
* @return mixed
*/
- abstract function invoke(
+ public abstract function invoke(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix
*
* @return array|bool
*/
- function commonInvoke(
+ public function commonInvoke(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix, $fnPrefix
*
* @return array|bool
*/
- function runHooks(
+ public function runHooks(
$civiModules, $fnSuffix, $numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6
) {
}
if (!empty($fResult) &&
- is_array($fResult)) {
+ is_array($fResult)
+ ) {
$result = array_merge($result, $fResult);
}
}
* @param array $params
* The parameters used for object creation / editing.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function pre($op, $objectName, $id, &$params) {
$event = new \Civi\Core\Event\PreEvent($op, $objectName, $id, $params);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_pre", $event);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_pre::$objectName", $event);
- return self::singleton()->invoke(4, $op, $objectName, $id, $params, self::$_nullObject, self::$_nullObject, 'civicrm_pre');
+ return self::singleton()
+ ->invoke(4, $op, $objectName, $id, $params, self::$_nullObject, self::$_nullObject, 'civicrm_pre');
}
/**
* @param object $objectRef
* The reference to the object if available.
*
- * @return mixed based on op. pre-hooks return a boolean or
+ * @return mixed
+ * based on op. pre-hooks return a boolean or
* an error message which aborts the operation
*/
public static function post($op, $objectName, $objectId, &$objectRef) {
$event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_post", $event);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_post::$objectName", $event);
- return self::singleton()->invoke(4, $op, $objectName, $objectId, $objectRef, self::$_nullObject, self::$_nullObject, 'civicrm_post');
+ return self::singleton()
+ ->invoke(4, $op, $objectName, $objectId, $objectRef, self::$_nullObject, self::$_nullObject, 'civicrm_post');
}
/**
* @param array $values
* (optional) the values to fill the links.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function links($op, $objectName, &$objectId, &$links, &$mask = NULL, &$values = array()) {
return self::singleton()->invoke(6, $op, $objectName, $objectId, $links, $mask, $values, 'civicrm_links');
* @param CRM_Core_Form $form
* Reference to the form object.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function preProcess($formName, &$form) {
- return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
+ return self::singleton()
+ ->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
}
/**
* @param CRM_Core_Form $form
* Reference to the form object.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function buildForm($formName, &$form) {
- return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_buildForm');
+ return self::singleton()->invoke(2, $formName, $form,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_buildForm'
+ );
}
/**
* @param CRM_Core_Form $form
* Reference to the form object.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function postProcess($formName, &$form) {
- return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_postProcess');
+ return self::singleton()->invoke(2, $formName, $form,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_postProcess'
+ );
}
/**
* @param array &$files the FILES parameters as sent in by POST
* @param array &$form the form object
*
- * @return mixed formRule hooks return a boolean or
+ * @return mixed
+ * formRule hooks return a boolean or
* an array of error messages which display a QF Error
*/
public static function validate($formName, &$fields, &$files, &$form) {
- return self::singleton()->invoke(4, $formName, $fields, $files, $form, self::$_nullObject, self::$_nullObject, 'civicrm_validate');
+ return self::singleton()
+ ->invoke(4, $formName, $fields, $files, $form, self::$_nullObject, self::$_nullObject, 'civicrm_validate');
}
/**
* @param array &$form the form object
* @param array &$errors the array of errors.
*
- * @return mixed formRule hooks return a boolean or
+ * @return mixed
+ * formRule hooks return a boolean or
* an array of error messages which display a QF Error
*/
public static function validateForm($formName, &$fields, &$files, &$form, &$errors) {
- return self::singleton()->invoke(5, $formName, $fields, $files, $form, $errors, self::$_nullObject, 'civicrm_validateForm');
+ return self::singleton()
+ ->invoke(5, $formName, $fields, $files, $form, $errors, self::$_nullObject, 'civicrm_validateForm');
}
/**
* @param array $params
* The parameters that were sent into the calling function.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function custom($op, $groupID, $entityID, &$params) {
- return self::singleton()->invoke(4, $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_custom');
+ return self::singleton()
+ ->invoke(4, $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_custom');
}
/**
* @param string $where
* The currrent where clause.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function aclWhereClause($type, &$tables, &$whereTables, &$contactID, &$where) {
- return self::singleton()->invoke(5, $type, $tables, $whereTables, $contactID, $where, self::$_nullObject, 'civicrm_aclWhereClause');
+ return self::singleton()
+ ->invoke(5, $type, $tables, $whereTables, $contactID, $where, self::$_nullObject, 'civicrm_aclWhereClause');
}
/**
* @param array $currentGroups
* The set of objects that are currently permissioned for this contact.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
- return self::singleton()->invoke(5, $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup');
+ return self::singleton()
+ ->invoke(5, $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup');
}
/**
* @param array $files
* The current set of files to process.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function xmlMenu(&$files) {
return self::singleton()->invoke(1, $files,
* @param array $entities
* List of pending entities.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function managed(&$entities) {
return self::singleton()->invoke(1, $entities,
* (output parameter) where should the hook content be displayed.
* relative to the activity list
*
- * @return string the html snippet to include in the dashboard
+ * @return string
+ * the html snippet to include in the dashboard
*/
public static function dashboard($contactID, &$contentPlacement = self::DASHBOARD_BELOW) {
$retval = self::singleton()->invoke(2, $contactID, $contentPlacement,
* @param CRM_Core_DAO $dao
* The item for which we want a reference count.
* @param array $refCounts
- * Each item in the array is an array with keys:.
+ * 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 null
*/
- static function tokenValues(
+ public static function tokenValues(
&$details,
$contactIDs,
$jobID = NULL,
$tokens = array(),
$className = NULL
) {
- return self::singleton()->invoke(5, $details, $contactIDs, $jobID, $tokens, $className, self::$_nullObject, 'civicrm_tokenValues');
+ return self::singleton()
+ ->invoke(5, $details, $contactIDs, $jobID, $tokens, $className, self::$_nullObject, 'civicrm_tokenValues');
}
/**
* @return mixed
*/
public static function unsubscribeGroups($op, $mailingId, $contactId, &$groups, &$baseGroups) {
- return self::singleton()->invoke(5, $op, $mailingId, $contactId, $groups, $baseGroups, self::$_nullObject, 'civicrm_unsubscribeGroups');
+ return self::singleton()
+ ->invoke(5, $op, $mailingId, $contactId, $groups, $baseGroups, self::$_nullObject, 'civicrm_unsubscribeGroups');
}
/**
*
* @return mixed
*/
- static function alterPaymentProcessorParams(
+ public static function alterPaymentProcessorParams(
$paymentObj,
&$rawParams,
&$cookedParams
*
* @param array $params
* Array fields include: groupName, from, toName, toEmail, subject, cc, bcc, text, html,
- * returnPath, replyTo, headers, attachments (array)
+ * returnPath, replyTo, headers, attachments (array)
* @param string $context
* The context in which the hook is being invoked, eg 'civimail'.
*
* @param int $caseID
* The case ID.
*
- * @return 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
+ * @return array
+ * 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
*/
public static function caseSummary($caseID) {
return self::singleton()->invoke(1, $caseID,
* @return mixed
*/
public static function caseTypes(&$caseTypes) {
- return self::singleton()->invoke(1, $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes');
+ return self::singleton()
+ ->invoke(1, $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes');
}
/**
* @return mixed
*/
public static function emailProcessor($type, &$params, $mail, &$result, $action = NULL) {
- return self::singleton()->invoke(5, $type, $params, $mail, $result, $action, self::$_nullObject, 'civicrm_emailProcessor');
+ return self::singleton()
+ ->invoke(5, $type, $params, $mail, $result, $action, self::$_nullObject, 'civicrm_emailProcessor');
}
/**
* activity, campaign, case, contact, contribution, event, grant, membership, and pledge
* @param array &$headers the list of column headers, an associative array with keys: ( name, sort, order )
* @param array &$rows the list of values, an associate array with fields that are displayed for that component
- * @param $selector
+ * @param array $selector
+ * the selector object. Allows you access to the context of the search
*
- * @internal param array $seletor the selector object. Allows you access to the context of the search
- *
- * @return void modify the header and values object to pass the data u need
+ * @return void
+ * modify the header and values object to pass the data u need
*/
public static function searchColumns($objectName, &$headers, &$rows, &$selector) {
return self::singleton()->invoke(4, $objectName, $headers, $rows, $selector,
*/
public static function alterSettingsFolders(&$settingsFolders) {
return self::singleton()->invoke(1, $settingsFolders,
- self::$_nullObject, self::$_nullObject,
- self::$_nullObject, self::$_nullObject, self::$_nullObject,
- 'civicrm_alterSettingsFolders'
+ self::$_nullObject, self::$_nullObject,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_alterSettingsFolders'
);
}
*/
public static function alterSettingsMetaData(&$settingsMetaData, $domainID, $profile) {
return self::singleton()->invoke(3, $settingsMetaData,
- $domainID, $profile,
- self::$_nullObject, self::$_nullObject, self::$_nullObject,
- 'civicrm_alterSettingsMetaData'
+ $domainID, $profile,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_alterSettingsMetaData'
);
}
public static function apiWrappers(&$wrappers, $apiRequest) {
return self::singleton()
->invoke(2, $wrappers, $apiRequest, self::$_nullObject, self::$_nullObject, self::$_nullObject,
- self::$_nullObject, 'civicrm_apiWrappers'
- );
+ self::$_nullObject, 'civicrm_apiWrappers'
+ );
}
/**
* @param mixed $request
* Reserved for future use.
*/
- static function unhandledException($exception, $request = NULL) {
- self::singleton()->invoke(2, $exception, $request, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_unhandled_exception');
+ public static function unhandledException($exception, $request = NULL) {
+ self::singleton()
+ ->invoke(2, $exception, $request, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_unhandled_exception');
// == 4.4 ==
//$event = new stdClass();
//$event->exception = $exception;
* @param array $participant
* Array of participant values.
*
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*/
public static function alterBadge($labelName, &$label, &$format, &$participant) {
- return self::singleton()->invoke(4, $labelName, $label, $format, $participant, self::$_nullObject, self::$_nullObject, 'civicrm_alterBadge');
+ return self::singleton()
+ ->invoke(4, $labelName, $label, $format, $participant, self::$_nullObject, self::$_nullObject, 'civicrm_alterBadge');
}
* @return mixed
*/
public static function queryObjects(&$queryObjects, $type = 'Contact') {
- return self::singleton()->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects');
+ return self::singleton()
+ ->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects');
}
/**
* @return mixed
*/
public static function dashboard_defaults($availableDashlets, &$defaultDashlets) {
- return self::singleton()->invoke(2, $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults');
+ return self::singleton()
+ ->invoke(2, $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults');
}
/**
* @return void
*/
public static function pre_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
- return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_pre_case_merge');
+ return self::singleton()
+ ->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_pre_case_merge');
}
/**
* @return void
*/
public static function post_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
- return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_post_case_merge');
+ return self::singleton()
+ ->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_post_case_merge');
}
/**
*
* @param array $angularModules
* List of modules.
- * @return null the return value is ignored
+ * @return null
+ * the return value is ignored
*
* @code
* function mymod_civicrm_angularModules(&$angularModules) {
* @param CRM_Core_DAO $bao
* @param array $link
* To define the link, add these keys to $link:.
- * - title: string
- * - path: string
- * - query: array
- * - url: string (used in lieu of "path"/"query")
+ * - title: string
+ * - path: string
+ * - query: array
+ * - url: string (used in lieu of "path"/"query")
* Note: if making "url" CRM_Utils_System::url(), set $htmlize=false
* @return mixed
*/
}
/**
- * @param array<CRM_Core_FileSearchInterface> $fileSearches
+ * @param array <CRM_Core_FileSearchInterface> $fileSearches
* @return mixed
*/
public static function fileSearches(&$fileSearches) {
'civicrm_fileSearches'
);
}
+
}