Merge pull request #17828 from eileenmcnaughton/matt
[civicrm-core.git] / ext / flexmailer / flexmailer.php
CommitLineData
bdf67e28
SL
1<?php
2
3/**
4 * Civi v5.19 does not provide all the API's we would need to define
5 * FlexMailer in an extension, but you can patch core to simulate them.
6 * These define()s tell core to enable any such hacks (if available).
7 */
8
9define('CIVICRM_FLEXMAILER_HACK_DELIVER', '\Civi\FlexMailer\FlexMailer::createAndRun');
10define('CIVICRM_FLEXMAILER_HACK_SENDABLE', '\Civi\FlexMailer\Validator::createAndRun');
11define('CIVICRM_FLEXMAILER_HACK_REQUIRED_TOKENS', 'call://civi_flexmailer_required_tokens/getRequiredTokens');
12
13require_once 'flexmailer.civix.php';
14
15use CRM_Flexmailer_ExtensionUtil as E;
16
17/**
18 * Implements hook_civicrm_config().
19 *
20 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
21 */
22function flexmailer_civicrm_config(&$config) {
23 _flexmailer_civix_civicrm_config($config);
24}
25
26/**
27 * Implements hook_civicrm_xmlMenu().
28 *
29 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_xmlMenu
30 */
31function flexmailer_civicrm_xmlMenu(&$files) {
32 _flexmailer_civix_civicrm_xmlMenu($files);
33}
34
35/**
36 * Implements hook_civicrm_install().
37 *
38 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
39 */
40function flexmailer_civicrm_install() {
41 _flexmailer_civix_civicrm_install();
42}
43
44/**
45 * Implements hook_civicrm_postInstall().
46 *
47 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_postInstall
48 */
49function flexmailer_civicrm_postInstall() {
50 _flexmailer_civix_civicrm_postInstall();
51}
52
53/**
54 * Implements hook_civicrm_uninstall().
55 *
56 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall
57 */
58function flexmailer_civicrm_uninstall() {
59 _flexmailer_civix_civicrm_uninstall();
60}
61
62/**
63 * Implements hook_civicrm_enable().
64 *
65 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable
66 */
67function flexmailer_civicrm_enable() {
68 _flexmailer_civix_civicrm_enable();
69}
70
71/**
72 * Implements hook_civicrm_disable().
73 *
74 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable
75 */
76function flexmailer_civicrm_disable() {
77 _flexmailer_civix_civicrm_disable();
78}
79
80/**
81 * Implements hook_civicrm_upgrade().
82 *
83 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_upgrade
84 */
85function flexmailer_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
86 return _flexmailer_civix_civicrm_upgrade($op, $queue);
87}
88
89/**
90 * Implements hook_civicrm_managed().
91 *
92 * Generate a list of entities to create/deactivate/delete when this module
93 * is installed, disabled, uninstalled.
94 *
95 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_managed
96 */
97function flexmailer_civicrm_managed(&$entities) {
98 _flexmailer_civix_civicrm_managed($entities);
99}
100
101/**
102 * Implements hook_civicrm_angularModules().
103 *
104 * Generate a list of Angular modules.
105 *
106 * Note: This hook only runs in CiviCRM 4.5+. It may
107 * use features only available in v4.6+.
108 *
109 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_caseTypes
110 */
111function flexmailer_civicrm_angularModules(&$angularModules) {
112 _flexmailer_civix_civicrm_angularModules($angularModules);
113}
114
115/**
116 * Implements hook_civicrm_alterSettingsFolders().
117 *
118 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterSettingsFolders
119 */
120function flexmailer_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
121 _flexmailer_civix_civicrm_alterSettingsFolders($metaDataFolders);
122}
123
124/**
125 * Implements hook_civicrm_navigationMenu().
126 *
127 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_navigationMenu
128 */
129function flexmailer_civicrm_navigationMenu(&$menu) {
130 _flexmailer_civix_insert_navigation_menu($menu, 'Administer/CiviMail', [
131 'label' => E::ts('Flexmailer Settings'),
132 'name' => 'flexmailer_settings',
133 'permission' => 'administer CiviCRM',
134 'child' => [],
135 'operator' => 'AND',
136 'separator' => 0,
137 'url' => CRM_Utils_System::url('civicrm/admin/setting/flexmailer', 'reset=1', TRUE),
138 ]);
139 _flexmailer_civix_navigationMenu($menu);
140}
141
142/**
143 * Implements hook_civicrm_container().
144 */
145function flexmailer_civicrm_container($container) {
146 $container->addResource(new \Symfony\Component\Config\Resource\FileResource(__FILE__));
147 \Civi\FlexMailer\Services::registerServices($container);
148}
149
150/**
151 * Get a list of delivery options for traditional mailings.
152 *
153 * @return array
154 * Array (string $machineName => string $label).
155 */
156function _flexmailer_traditional_options() {
157 return array(
158 'auto' => E::ts('Automatic'),
159 'bao' => E::ts('CiviMail BAO'),
160 'flexmailer' => E::ts('Flexmailer Pipeline'),
161 );
162}