const SUMMARY_REPLACE = 3;
/**
- * @var ojbect
+ * Object to pass when an object is required to be passed by params.
+ *
+ * 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.
+ *
+ * @var null
*/
public static $_nullObject = NULL;
* We only need one instance of this object. So we use the singleton
* pattern and cache the instance in this variable
*
- * @var object
+ * @var CRM_Utils_Hook
*/
static private $_singleton = NULL;
*
* @param bool $fresh
*
- * @return self
+ * @return CRM_Utils_Hook
* An instance of $config->userHookClass
*/
public static function singleton($fresh = FALSE) {
/**
* CRM_Utils_Hook constructor.
+ *
+ * @throws \CRM_Core_Exception
*/
public function __construct() {
$this->cache = CRM_Utils_Cache::create([
}
/**
- * @param $civiModules
- * @param $fnSuffix
- * @param array $numParams
- * @param $arg1
- * @param $arg2
- * @param $arg3
- * @param $arg4
- * @param $arg5
- * @param $arg6
+ * Run hooks.
+ *
+ * @param array $civiModules
+ * @param string $fnSuffix
+ * @param int $numParams
+ * @param mixed $arg1
+ * @param mixed $arg2
+ * @param mixed $arg3
+ * @param mixed $arg4
+ * @param mixed $arg5
+ * @param mixed $arg6
*
* @return array|bool
+ * @throws \Exception
*/
public function runHooks(
$civiModules, $fnSuffix, $numParams,
);
}
+ /**
+ * 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:
+ *
+ * - 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).
+ *
+ * @param array $themes
+ * List of themes, keyed by name.
+ * @return null
+ * the return value is ignored
+ */
+ public static function themes(&$themes) {
+ return self::singleton()->invoke(1, $themes,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_themes'
+ );
+ }
+
+ /**
+ * The activeTheme hook determines which theme is active.
+ *
+ * @param string $theme
+ * The identifier for the theme. Alterable.
+ * Ex: 'greenwich'.
+ * @param array $context
+ * 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 null
+ * the return value is ignored
+ */
+ public static function activeTheme(&$theme, $context) {
+ return self::singleton()->invoke(array('theme', 'context'), $theme, $context,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_activeTheme'
+ );
+ }
+
/**
* This hook is called for declaring managed entities via API.
*
);
}
+ /**
+ * This hook allows modification of the admin panels
+ *
+ * @param array $panels
+ * Associated array of admin panels
+ *
+ * @return mixed
+ */
+ public static function alterAdminPanel(&$panels) {
+ return self::singleton()->invoke(array('panels'), $panels,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ 'civicrm_alterAdminPanel'
+ );
+ }
+
/**
* This hook is called when sending an email / printing labels to get the values for all the
* tokens returned by the 'tokens' hook
}
/**
- * @param CRM_Core_ExceptionObject $exception
+ * @param CRM_Core_Exception $exception
* @param mixed $request
* Reserved for future use.
*/
/**
* This hook is called for declaring managed entities via API.
*
- * Note: This is a preboot hook. It will dispatch via the extension/module
+ * Note: This is a pre-boot hook. It will dispatch via the extension/module
* subsystem but *not* the Symfony EventDispatcher.
*
* @param array[] $entityTypes
/**
* This hook is called before an inbound SMS is processed.
*
- * @param \CRM_SMS_MessageObject $message
+ * @param \CRM_SMS_Message $message
* An SMS message received
* @return mixed
*/