Merge pull request #16615 from MegaphoneJon/selfsfc-refactor
[civicrm-core.git] / setup / plugins / blocks / sample-data.civi-setup.php
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['sample-data'] = array(
16 'is_active' => TRUE,
17 'file' => __DIR__ . DIRECTORY_SEPARATOR . 'sample-data.tpl.php',
18 'class' => 'if-no-errors',
19 'weight' => 40,
20 );
21
22 if ($e->getMethod() === 'POST') {
23 $e->getModel()->loadGenerated = !empty($e->getField('loadGenerated'));
24 }
25
26 }, \Civi\Setup::PRIORITY_PREPARE);