X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FHook.php;h=915f8309431192acfcdb73fedf938ff603944b51;hb=0d259bef5d711eeda394d0694e43349dec7a0ebb;hp=1d9505990f988cbd388fe449de3efd0a5f8bbdbb;hpb=d36b8b20ac964dc3c0a74f98f580dc7b0ad7383e;p=civicrm-core.git diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index 1d9505990f..915f830943 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,12 +23,12 @@ | 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: $ * */ @@ -56,7 +56,6 @@ abstract class CRM_Utils_Hook { * pattern and cache the instance in this variable * * @var object - * @static */ static private $_singleton = NULL; @@ -71,7 +70,7 @@ abstract class CRM_Utils_Hook { private $commonCiviModules = array(); /** - * Constructor and getter for the singleton instance + * Constructor and getter for the singleton instance. * * @param bool $fresh * @@ -89,7 +88,7 @@ abstract class CRM_Utils_Hook { } /** - * Invoke hooks + * Invoke hooks. * * @param int $numParams * Number of parameters to pass to the hook. @@ -308,7 +307,7 @@ abstract class CRM_Utils_Hook { } /** - * 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 @@ -425,7 +424,7 @@ abstract class CRM_Utils_Hook { } /** - * 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. @@ -491,7 +490,7 @@ abstract class CRM_Utils_Hook { } /** - * 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. @@ -507,10 +506,21 @@ abstract class CRM_Utils_Hook { } /** - * 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 @@ -568,7 +578,7 @@ abstract class CRM_Utils_Hook { } /** - * 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. @@ -577,7 +587,9 @@ abstract class CRM_Utils_Hook { * - 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, @@ -587,7 +599,7 @@ abstract class CRM_Utils_Hook { } /** - * 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. @@ -860,7 +872,7 @@ abstract class CRM_Utils_Hook { } /** - * 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 @@ -915,17 +927,22 @@ abstract class CRM_Utils_Hook { * * 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, @@ -957,7 +974,7 @@ abstract class CRM_Utils_Hook { } /** - * 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. @@ -982,7 +999,7 @@ abstract class CRM_Utils_Hook { } /** - * 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. @@ -1027,21 +1044,7 @@ abstract class CRM_Utils_Hook { } /** - * @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 @@ -1108,7 +1111,7 @@ abstract class CRM_Utils_Hook { } /** - * 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. @@ -1315,7 +1318,7 @@ abstract class CRM_Utils_Hook { } /** - * 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. @@ -1356,7 +1359,7 @@ abstract class CRM_Utils_Hook { } /** - * This hooks allows alteration of generated page content + * This hooks allows alteration of generated page content. * * @param $content * Previously generated content. @@ -1399,7 +1402,7 @@ abstract class CRM_Utils_Hook { } /** - * This hook collects the trigger definition from all components + * This hook collects the trigger definition from all components. * * @param $info * @param string $tableName @@ -1531,7 +1534,7 @@ abstract class CRM_Utils_Hook { } /** - * 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 @@ -1634,7 +1637,7 @@ abstract class CRM_Utils_Hook { } /** - * 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: @@ -1652,7 +1655,7 @@ abstract class CRM_Utils_Hook { } /** - * This hook is called while preparing a profile form + * This hook is called while preparing a profile form. * * @param string $name * @return mixed @@ -1663,7 +1666,7 @@ abstract class CRM_Utils_Hook { } /** - * 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 @@ -1674,7 +1677,7 @@ abstract class CRM_Utils_Hook { } /** - * 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 @@ -1728,7 +1731,7 @@ abstract class CRM_Utils_Hook { /** - * 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. @@ -1777,7 +1780,7 @@ abstract class CRM_Utils_Hook { } /** - * 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 @@ -1853,8 +1856,16 @@ abstract class CRM_Utils_Hook { * * @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 */ @@ -1881,7 +1892,7 @@ abstract class CRM_Utils_Hook { } /** - * Generate a default CRUD URL for an entity + * Generate a default CRUD URL for an entity. * * @param array $spec * With keys:. @@ -1915,4 +1926,5 @@ abstract class CRM_Utils_Hook { 'civicrm_fileSearches' ); } + }