+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CiviCRM_Hook
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id: $
*
*/
* pattern and cache the instance in this variable
*
* @var object
- * @static
*/
static private $_singleton = NULL;
private $commonCiviModules = array();
/**
- * Constructor and getter for the singleton instance
+ * Constructor and getter for the singleton instance.
*
* @param bool $fresh
*
}
/**
- * Invoke hooks
+ * Invoke hooks.
*
* @param int $numParams
* Number of parameters to pass to the hook.
* @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);
* @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) {
}
/**
- * This hook retrieves links from other modules and injects it into
+ * This hook retrieves links from other modules and injects it into.
* the view contact tabs
*
* @param string $op
* @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');
+ ->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,
* @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,
* @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) {
* @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) {
}
/**
- * This hook is called before a db write on a custom table
+ * This hook is called after a db write on a custom table.
*
* @param string $op
* The type of operation being performed.
* @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()
* @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()
* @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()
}
/**
- * This hook is called when building the menu table
+ * This hook is called when building the menu table.
*
* @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,
}
/**
- * This hook is called for declaring managed entities via API
+ * This hook is called for declaring managed entities via API.
*
* @param array $entities
- * List of pending entities.
+ * 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.)
*
- * @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,
}
/**
- * Determine how many other records refer to a given record
+ * Determine how many other records refer to a given record.
*
* @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 void
+ *
+ * @return mixed
+ * Return is not really intended to be used.
*/
public static function referenceCounts($dao, &$refCounts) {
return self::singleton()->invoke(2, $dao, $refCounts,
}
/**
- * This hook is called when building the amount structure for a Contribution or Event Page
+ * This hook is called when building the amount structure for a Contribution or Event Page.
*
* @param int $pageType
* Is this a contribution or event page.
}
/**
- * This hook is called when rendering the contact summary
+ * This hook is called when rendering the contact summary.
*
* @param int $contactID
* The contactID for whom the summary is being rendered
*
* Definition will look like this:
*
- * function hook_civicrm_alterPaymentProcessorParams($paymentObj,
- * &$rawParams, &$cookedParams);
+ * function hook_civicrm_alterPaymentProcessorParams(
+ * $paymentObj,
+ * &$rawParams,
+ * &$cookedParams
+ * );
*
- * @param string $paymentObj
- * instance of payment class of the payment processor invoked (e.g., 'CRM_Core_Payment_Dummy')
+ * @param CRM_Core_Payment $paymentObj
+ * 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.
* @param array &$rawParams
* array of params as passed to to the processor
* @param array &$cookedParams
* params after the processor code has translated them into its own key/value pairs
*
* @return mixed
+ * This return is not really intended to be used.
*/
public static function alterPaymentProcessorParams(
$paymentObj,
*
* @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'.
*
}
/**
- * This hook is called when membership status is being calculated
+ * This hook is called when membership status is being calculated.
*
* @param array $membershipStatus
* Membership status details as determined - alter if required.
}
/**
- * This hook is called when rendering the Manage Case screen
+ * This hook is called when rendering the Manage Case screen.
*
* @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,
}
/**
- * @param $recordBAO
- * @param int $recordID
- * @param $isActive
- *
- * @return mixed
- */
- public static function enableDisable($recordBAO, $recordID, $isActive) {
- return self::singleton()->invoke(3, $recordBAO, $recordID, $isActive,
- self::$_nullObject, self::$_nullObject, self::$_nullObject,
- 'civicrm_enableDisable'
- );
- }
-
- /**
- * This hooks allows to change option values
+ * This hooks allows to change option values.
*
* @param array $options
* Associated array of option values / id
}
/**
- * This hook is called before record is exported as CSV
+ * This hook is called before record is exported as CSV.
*
* @param string $exportTempTable
* Name of the temporary export table used during export.
* 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
- *
- * @internal param array $seletor the selector object. Allows you access to the context of the search
+ * @param array $selector
+ * 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,
}
/**
- * Hook definition for altering the generation of Mailing Labels
+ * Hook definition for altering the generation of Mailing Labels.
*
* @param array $args
* An array of the args in the order defined for the tcpdf multiCell api call.
}
/**
- * This hooks allows alteration of generated page content
+ * This hooks allows alteration of generated page content.
*
* @param $content
* Previously generated content.
}
/**
- * This hook collects the trigger definition from all components
+ * This hook collects the trigger definition from all components.
*
* @param $info
* @param string $tableName
}
/**
- * This hook is called when Settings specifications are loaded
+ * This hook is called when Settings specifications are loaded.
*
* @param array $settingsFolders
* List of paths from which to derive metadata
}
/**
- * This hook is called for declaring managed entities via API
+ * This hook is called for declaring managed entities via API.
*
* @param array[] $entityTypes
* List of entity types; each entity-type is an array with keys:
}
/**
- * This hook is called while preparing a profile form
+ * This hook is called while preparing a profile form.
*
* @param string $name
* @return mixed
}
/**
- * This hook is called while validating a profile form submission
+ * This hook is called while validating a profile form submission.
*
* @param string $name
* @return mixed
}
/**
- * This hook is called processing a valid profile form submission
+ * This hook is called processing a valid profile form submission.
*
* @param string $name
* @return mixed
* @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()
/**
- * This hook is called before encoding data in barcode
+ * This hook is called before encoding data in barcode.
*
* @param array $data
* Associated array of values available for encoding.
}
/**
- * This hook is called while viewing contact dashboard
+ * This hook is called while viewing contact dashboard.
*
* @param array $availableDashlets
* List of dashlets; each is formatted per api/v3/Dashboard
*
* @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) {
- * $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'), 'css' => array('css/myAngularModule.css'));
+ * $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'),
+ * 'css' => array('css/myAngularModule.css'),
+ * 'partials' => array('partials/myBigAngularModule'),
+ * );
* }
* @endcode
*/
}
/**
- * Generate a default CRUD URL for an entity
+ * Generate a default CRUD URL for an entity.
*
* @param array $spec
* With keys:.
* @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
*/
'civicrm_fileSearches'
);
}
+
}