Merge pull request #23756 from eileenmcnaughton/import_to_group
[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
bdf67e28
SL
26/**
27 * Implements hook_civicrm_install().
28 *
29 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
30 */
31function flexmailer_civicrm_install() {
32 _flexmailer_civix_civicrm_install();
33}
34
35/**
36 * Implements hook_civicrm_postInstall().
37 *
38 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_postInstall
39 */
40function flexmailer_civicrm_postInstall() {
41 _flexmailer_civix_civicrm_postInstall();
42}
43
44/**
45 * Implements hook_civicrm_uninstall().
46 *
47 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall
48 */
49function flexmailer_civicrm_uninstall() {
50 _flexmailer_civix_civicrm_uninstall();
51}
52
53/**
54 * Implements hook_civicrm_enable().
55 *
56 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable
57 */
58function flexmailer_civicrm_enable() {
59 _flexmailer_civix_civicrm_enable();
60}
61
62/**
63 * Implements hook_civicrm_disable().
64 *
65 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable
66 */
67function flexmailer_civicrm_disable() {
68 _flexmailer_civix_civicrm_disable();
69}
70
71/**
72 * Implements hook_civicrm_upgrade().
73 *
74 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_upgrade
75 */
76function flexmailer_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
77 return _flexmailer_civix_civicrm_upgrade($op, $queue);
78}
79
bdf67e28
SL
80/**
81 * Implements hook_civicrm_navigationMenu().
82 *
83 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_navigationMenu
84 */
85function flexmailer_civicrm_navigationMenu(&$menu) {
86 _flexmailer_civix_insert_navigation_menu($menu, 'Administer/CiviMail', [
87 'label' => E::ts('Flexmailer Settings'),
88 'name' => 'flexmailer_settings',
89 'permission' => 'administer CiviCRM',
90 'child' => [],
91 'operator' => 'AND',
92 'separator' => 0,
93 'url' => CRM_Utils_System::url('civicrm/admin/setting/flexmailer', 'reset=1', TRUE),
94 ]);
95 _flexmailer_civix_navigationMenu($menu);
96}
97
98/**
99 * Implements hook_civicrm_container().
100 */
101function flexmailer_civicrm_container($container) {
102 $container->addResource(new \Symfony\Component\Config\Resource\FileResource(__FILE__));
103 \Civi\FlexMailer\Services::registerServices($container);
104}
105
106/**
107 * Get a list of delivery options for traditional mailings.
108 *
109 * @return array
110 * Array (string $machineName => string $label).
111 */
112function _flexmailer_traditional_options() {
113 return array(
114 'auto' => E::ts('Automatic'),
115 'bao' => E::ts('CiviMail BAO'),
116 'flexmailer' => E::ts('Flexmailer Pipeline'),
117 );
118}