Commit | Line | Data |
---|---|---|
301b8b4b SL |
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_xmlMenu(). | |
19 | * | |
20 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_xmlMenu | |
21 | */ | |
22 | function ckeditor4_civicrm_xmlMenu(&$files) { | |
23 | _ckeditor4_civix_civicrm_xmlMenu($files); | |
24 | } | |
25 | ||
26 | /** | |
27 | * Implements hook_civicrm_install(). | |
28 | * | |
29 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install | |
30 | */ | |
31 | function ckeditor4_civicrm_install() { | |
32 | _ckeditor4_civix_civicrm_install(); | |
33 | } | |
34 | ||
35 | /** | |
36 | * Implements hook_civicrm_postInstall(). | |
37 | * | |
38 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall | |
39 | */ | |
40 | function ckeditor4_civicrm_postInstall() { | |
41 | _ckeditor4_civix_civicrm_postInstall(); | |
42 | } | |
43 | ||
44 | /** | |
45 | * Implements hook_civicrm_uninstall(). | |
46 | * | |
47 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall | |
48 | */ | |
49 | function ckeditor4_civicrm_uninstall() { | |
50 | _ckeditor4_civix_civicrm_uninstall(); | |
51 | } | |
52 | ||
53 | /** | |
54 | * Implements hook_civicrm_enable(). | |
55 | * | |
56 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable | |
57 | */ | |
58 | function ckeditor4_civicrm_enable() { | |
59 | _ckeditor4_civix_civicrm_enable(); | |
60 | } | |
61 | ||
62 | /** | |
63 | * Implements hook_civicrm_disable(). | |
64 | * | |
65 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable | |
66 | */ | |
67 | function ckeditor4_civicrm_disable() { | |
68 | _ckeditor4_civix_civicrm_disable(); | |
69 | } | |
70 | ||
71 | /** | |
72 | * Implements hook_civicrm_upgrade(). | |
73 | * | |
74 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade | |
75 | */ | |
76 | function ckeditor4_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { | |
77 | return _ckeditor4_civix_civicrm_upgrade($op, $queue); | |
78 | } | |
79 | ||
80 | /** | |
81 | * Implements hook_civicrm_managed(). | |
82 | * | |
83 | * Generate a list of entities to create/deactivate/delete when this module | |
84 | * is installed, disabled, uninstalled. | |
85 | * | |
86 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed | |
87 | */ | |
88 | function ckeditor4_civicrm_managed(&$entities) { | |
89 | _ckeditor4_civix_civicrm_managed($entities); | |
90 | } | |
91 | ||
92 | /** | |
93 | * Implements hook_civicrm_caseTypes(). | |
94 | * | |
95 | * Generate a list of case-types. | |
96 | * | |
97 | * Note: This hook only runs in CiviCRM 4.4+. | |
98 | * | |
99 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_caseTypes | |
100 | */ | |
101 | function ckeditor4_civicrm_caseTypes(&$caseTypes) { | |
102 | _ckeditor4_civix_civicrm_caseTypes($caseTypes); | |
103 | } | |
104 | ||
105 | /** | |
106 | * Implements hook_civicrm_angularModules(). | |
107 | * | |
108 | * Generate a list of Angular modules. | |
109 | * | |
110 | * Note: This hook only runs in CiviCRM 4.5+. It may | |
111 | * use features only available in v4.6+. | |
112 | * | |
113 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules | |
114 | */ | |
115 | function ckeditor4_civicrm_angularModules(&$angularModules) { | |
116 | _ckeditor4_civix_civicrm_angularModules($angularModules); | |
117 | } | |
118 | ||
119 | /** | |
120 | * Implements hook_civicrm_alterSettingsFolders(). | |
121 | * | |
122 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders | |
123 | */ | |
124 | function ckeditor4_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { | |
125 | _ckeditor4_civix_civicrm_alterSettingsFolders($metaDataFolders); | |
126 | } | |
127 | ||
128 | /** | |
129 | * Implements hook_civicrm_entityTypes(). | |
130 | * | |
131 | * Declare entity types provided by this module. | |
132 | * | |
133 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes | |
134 | */ | |
135 | function ckeditor4_civicrm_entityTypes(&$entityTypes) { | |
136 | _ckeditor4_civix_civicrm_entityTypes($entityTypes); | |
137 | } | |
138 | ||
139 | /** | |
140 | * Implements hook_civicrm_themes(). | |
141 | */ | |
142 | function ckeditor4_civicrm_themes(&$themes) { | |
143 | _ckeditor4_civix_civicrm_themes($themes); | |
144 | } | |
145 | ||
146 | function ckeditor4_civicrm_buildForm($formName, $form) { | |
147 | if ($formName === 'CRM_Admin_Form_Preferences_Display') { | |
148 | $form->addElement( | |
149 | 'xbutton', | |
150 | 'ckeditor_config', | |
151 | CRM_Core_Page::crmIcon('fa-wrench') . ' ' . E::ts('Configure CKEditor 4'), | |
152 | [ | |
153 | 'type' => 'submit', | |
154 | 'class' => 'crm-button', | |
155 | 'style' => 'display:inline-block;vertical-align:middle;float:none!important;', | |
156 | 'value' => 1, | |
157 | ] | |
158 | ); | |
98fdc576 CW |
159 | CRM_Core_Region::instance('form-bottom')->add([ |
160 | 'template' => 'CRM/Admin/Form/Preferences/Ckeditor.tpl', | |
161 | ]); | |
301b8b4b | 162 | } |
301b8b4b SL |
163 | } |
164 | ||
165 | function ckeditor4_civicrm_coreResourceList(&$list, $region) { | |
166 | // add wysiwyg editor | |
167 | $editor = \Civi::settings()->get('editor_id'); | |
168 | if ($editor == "CKEditor") { | |
169 | CRM_Ckeditor4_Form_CKEditorConfig::setConfigDefault(); | |
170 | $list[] = [ | |
171 | 'config' => [ | |
172 | 'wysisygScriptLocation' => E::url('js/crm.ckeditor.js'), | |
173 | 'CKEditorCustomConfig' => CRM_Ckeditor4_Form_CKEditorConfig::getConfigUrl(), | |
174 | ], | |
175 | ]; | |
176 | } | |
177 | } | |
178 | ||
179 | // --- Functions below this ship commented out. Uncomment as required. --- | |
180 | ||
181 | /** | |
182 | * Implements hook_civicrm_preProcess(). | |
183 | * | |
184 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_preProcess | |
185 | */ | |
186 | //function ckeditor4_civicrm_preProcess($formName, &$form) { | |
187 | // | |
188 | //} | |
189 | ||
190 | /** | |
191 | * Implements hook_civicrm_navigationMenu(). | |
192 | * | |
193 | * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_navigationMenu | |
194 | */ | |
195 | //function ckeditor4_civicrm_navigationMenu(&$menu) { | |
196 | // _ckeditor4_civix_insert_navigation_menu($menu, 'Mailings', array( | |
197 | // 'label' => E::ts('New subliminal message'), | |
198 | // 'name' => 'mailing_subliminal_message', | |
199 | // 'url' => 'civicrm/mailing/subliminal', | |
200 | // 'permission' => 'access CiviMail', | |
201 | // 'operator' => 'OR', | |
202 | // 'separator' => 0, | |
203 | // )); | |
204 | // _ckeditor4_civix_navigationMenu($menu); | |
205 | //} |