Enable ability to require tags in profiles
[civicrm-core.git] / ext / ckeditor4 / ckeditor4.php
1 <?php
2
3 require_once 'ckeditor4.civix.php';
4 // phpcs:disable
5 use CRM_Ckeditor4_ExtensionUtil as E;
6 // phpcs:enable
7
8 /**
9 * Implements hook_civicrm_config().
10 *
11 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
12 */
13 function ckeditor4_civicrm_config(&$config) {
14 _ckeditor4_civix_civicrm_config($config);
15 }
16
17 /**
18 * Implements hook_civicrm_install().
19 *
20 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
21 */
22 function ckeditor4_civicrm_install() {
23 _ckeditor4_civix_civicrm_install();
24 }
25
26 /**
27 * Implements hook_civicrm_postInstall().
28 *
29 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall
30 */
31 function ckeditor4_civicrm_postInstall() {
32 _ckeditor4_civix_civicrm_postInstall();
33 }
34
35 /**
36 * Implements hook_civicrm_uninstall().
37 *
38 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall
39 */
40 function ckeditor4_civicrm_uninstall() {
41 _ckeditor4_civix_civicrm_uninstall();
42 }
43
44 /**
45 * Implements hook_civicrm_enable().
46 *
47 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
48 */
49 function ckeditor4_civicrm_enable() {
50 _ckeditor4_civix_civicrm_enable();
51 }
52
53 /**
54 * Implements hook_civicrm_disable().
55 *
56 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable
57 */
58 function ckeditor4_civicrm_disable() {
59 _ckeditor4_civix_civicrm_disable();
60 }
61
62 /**
63 * Implements hook_civicrm_upgrade().
64 *
65 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade
66 */
67 function ckeditor4_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
68 return _ckeditor4_civix_civicrm_upgrade($op, $queue);
69 }
70
71 /**
72 * Implements hook_civicrm_entityTypes().
73 *
74 * Declare entity types provided by this module.
75 *
76 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
77 */
78 function ckeditor4_civicrm_entityTypes(&$entityTypes) {
79 _ckeditor4_civix_civicrm_entityTypes($entityTypes);
80 }
81
82 function ckeditor4_civicrm_buildForm($formName, $form) {
83 if ($formName === 'CRM_Admin_Form_Preferences_Display') {
84 $form->addElement(
85 'xbutton',
86 'ckeditor_config',
87 CRM_Core_Page::crmIcon('fa-wrench') . ' ' . E::ts('Configure CKEditor 4'),
88 [
89 'type' => 'submit',
90 'class' => 'crm-button',
91 'style' => 'display:inline-block;vertical-align:middle;float:none!important;',
92 'value' => 1,
93 ]
94 );
95 CRM_Core_Region::instance('form-bottom')->add([
96 'template' => 'CRM/Admin/Form/Preferences/Ckeditor.tpl',
97 ]);
98 }
99 }
100
101 function ckeditor4_civicrm_coreResourceList(&$list, $region) {
102 // add wysiwyg editor
103 $editor = \Civi::settings()->get('editor_id');
104 if ($editor == "CKEditor") {
105 CRM_Ckeditor4_Form_CKEditorConfig::setConfigDefault();
106 $list[] = [
107 'config' => [
108 'wysisygScriptLocation' => E::url('js/crm.ckeditor.js'),
109 'CKEditorCustomConfig' => CRM_Ckeditor4_Form_CKEditorConfig::getConfigUrl(),
110 ],
111 ];
112 }
113 }
114
115 // --- Functions below this ship commented out. Uncomment as required. ---
116
117 /**
118 * Implements hook_civicrm_preProcess().
119 *
120 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_preProcess
121 */
122 //function ckeditor4_civicrm_preProcess($formName, &$form) {
123 //
124 //}
125
126 /**
127 * Implements hook_civicrm_navigationMenu().
128 *
129 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_navigationMenu
130 */
131 //function ckeditor4_civicrm_navigationMenu(&$menu) {
132 // _ckeditor4_civix_insert_navigation_menu($menu, 'Mailings', array(
133 // 'label' => E::ts('New subliminal message'),
134 // 'name' => 'mailing_subliminal_message',
135 // 'url' => 'civicrm/mailing/subliminal',
136 // 'permission' => 'access CiviMail',
137 // 'operator' => 'OR',
138 // 'separator' => 0,
139 // ));
140 // _ckeditor4_civix_navigationMenu($menu);
141 //}