Commit | Line | Data |
---|---|---|
4bcd4c62 TO |
1 | <?php |
2 | if (!defined('CIVI_SETUP')) { | |
3 | exit("Installation plugins must only be loaded by the installer.\n"); | |
4 | } | |
5 | ||
6 | \Civi\Setup::dispatcher() | |
7 | ->addListener('civi.setupui.boot', function (\Civi\Setup\UI\Event\UIBootEvent $e) { | |
8 | \Civi\Setup::log()->info(sprintf('[%s] Register blocks', basename(__FILE__))); | |
9 | ||
10 | /** | |
11 | * @var \Civi\Setup\UI\SetupController $ctrl | |
12 | */ | |
13 | $ctrl = $e->getCtrl(); | |
14 | ||
15 | $ctrl->blocks['components'] = array( | |
16 | 'is_active' => TRUE, | |
17 | 'file' => __DIR__ . DIRECTORY_SEPARATOR . 'components.tpl.php', | |
18 | 'class' => 'if-no-errors', | |
19 | 'weight' => 50, | |
20 | 'component_labels' => array( | |
21 | 'CiviContribute' => ts('Accept donations and payments'), | |
22 | 'CiviEvent' => ts('Accept event registrations'), | |
23 | 'CiviMail' => ts('Send email blasts and newsletters'), | |
24 | 'CiviMember' => ts('Manage recurring memberships'), | |
25 | 'CiviCase' => ts('Track case histories'), | |
26 | 'CiviPledge' => ts('Accept pledges'), | |
27 | 'CiviReport' => ts('Generate reports'), | |
28 | 'CiviCampaign' => ts('Organize campaigns, surveys, and petitions'), | |
29 | 'CiviGrant' => ts('Receive grant applications'), | |
30 | ), | |
31 | ); | |
32 | ||
33 | if ($e->getMethod() === 'POST' || is_array($e->getField('components'))) { | |
34 | $e->getModel()->components = array_keys($e->getField('components')); | |
35 | } | |
36 | ||
37 | }, \Civi\Setup::PRIORITY_PREPARE); |