3 require_once 'recaptcha.civix.php';
5 use CRM_Recaptcha_ExtensionUtil
as E
;
9 * Implements hook_civicrm_config().
11 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
13 function recaptcha_civicrm_config(&$config) {
14 _recaptcha_civix_civicrm_config($config);
18 * Implements hook_civicrm_install().
20 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
22 function recaptcha_civicrm_install() {
23 _recaptcha_civix_civicrm_install();
27 * Implements hook_civicrm_postInstall().
29 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall
31 function recaptcha_civicrm_postInstall() {
32 _recaptcha_civix_civicrm_postInstall();
36 * Implements hook_civicrm_uninstall().
38 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall
40 function recaptcha_civicrm_uninstall() {
41 _recaptcha_civix_civicrm_uninstall();
45 * Implements hook_civicrm_enable().
47 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
49 function recaptcha_civicrm_enable() {
50 _recaptcha_civix_civicrm_enable();
54 * Implements hook_civicrm_disable().
56 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable
58 function recaptcha_civicrm_disable() {
59 _recaptcha_civix_civicrm_disable();
63 * Implements hook_civicrm_upgrade().
65 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade
67 function recaptcha_civicrm_upgrade($op, CRM_Queue_Queue
$queue = NULL) {
68 return _recaptcha_civix_civicrm_upgrade($op, $queue);
72 * Implements hook_civicrm_entityTypes().
74 * Declare entity types provided by this module.
76 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
78 function recaptcha_civicrm_entityTypes(&$entityTypes) {
79 _recaptcha_civix_civicrm_entityTypes($entityTypes);
83 * Implements hook_civicrm_navigationMenu().
85 function recaptcha_civicrm_navigationMenu(&$menu) {
86 _recaptcha_civix_insert_navigation_menu($menu, 'Administer/System Settings', [
87 'label' => E
::ts('reCAPTCHA Settings'),
88 'name' => 'recaptcha_settings',
89 'url' => 'civicrm/admin/setting/recaptcha',
90 'permission' => 'administer CiviCRM',
94 _recaptcha_civix_navigationMenu($menu);
98 * Intercept form functions
100 function recaptcha_civicrm_buildForm($formName, &$form) {
102 case 'CRM_Admin_Form_Generic':
103 if ($form->getSettingPageFilter() !== 'recaptcha') {
108 'reCAPTCHA is a free service that helps prevent automated abuse of your site. To use it on public-facing CiviCRM forms: sign up at <a href="%1" target="_blank">Google\'s reCaptcha site</a>; enter the provided public and private keys here; then enable reCAPTCHA under Advanced Settings in any Profile.',
110 1 => 'https://www.google.com/recaptcha',
113 . '<br/><strong>' . E
::ts('Only the reCAPTCHA v2 checkbox type is supported.') . '</strong>';
115 ->addMarkup('<div class="help">' . $helpText . '</div>', [
117 'region' => 'page-body',