if (!is_array($names)) {
// We were called with the old contract wherein $names is actually an int.
// Symfony dispatcher requires some kind of name.
- Civi::log()->warning("hook_$fnSuffix should be updated to pass an array of parameter names to CRM_Utils_Hook::invoke().", ['civi.tag' => 'deprecated']);
+ CRM_Core_Error::deprecatedWarning("hook_$fnSuffix should be updated to pass an array of parameter names to CRM_Utils_Hook::invoke().");
$compatNames = ['arg1', 'arg2', 'arg3', 'arg4', 'arg5', 'arg6'];
$names = array_slice($compatNames, 0, (int) $names);
}
* @return null
* the return value is ignored
*/
- public static function pre($op, $objectName, $id, &$params) {
+ public static function pre($op, $objectName, $id, &$params = []) {
$event = new \Civi\Core\Event\PreEvent($op, $objectName, $id, $params);
\Civi::dispatcher()->dispatch('hook_civicrm_pre', $event);
return $event->getReturnValues();
}
/**
- * This hook is called when loading CMS permissions; use this hook to modify
+ * This hook is called when exporting Civi's permission to the CMS. Use this hook to modify
* the array of system permissions for CiviCRM.
*
* @param array $permissions
);
}
+ /**
+ * 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.
+ *
+ * @param array $permissions
+ * 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 (TRUE if this permission is defined by. Default: TRUE)
+ *
+ * @return null
+ * The return value is ignored
+ * @see Civi\Api4\Permission::get()
+ */
+ public static function permissionList(&$permissions) {
+ return self::singleton()->invoke(['permissions'], $permissions,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_permissionList'
+ );
+ }
+
/**
* This hook is called when checking permissions; use this hook to dynamically
* escalate user permissions in certain use cases (cf. CRM-19256).
\Civi::dispatcher()->dispatch('hook_civicrm_caseChange', $event);
}
- /**
- * Generate a default CRUD URL for an entity.
- *
- * @param array $spec
- * With keys:.
- * - action: int, eg CRM_Core_Action::VIEW or CRM_Core_Action::UPDATE
- * - entity_table: string
- * - entity_id: int
- * @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")
- * Note: if making "url" CRM_Utils_System::url(), set $htmlize=false
- * @return mixed
- * @deprecated
- */
- public static function crudLink($spec, $bao, &$link) {
- return self::singleton()->invoke(['spec', 'bao', 'link'], $spec, $bao, $link,
- self::$_nullObject, self::$_nullObject, self::$_nullObject,
- 'civicrm_crudLink'
- );
- }
-
/**
* Modify the CiviCRM container - add new services, parameters, extensions, etc.
*