From: Tim Otten Date: Sun, 16 Jul 2023 05:55:00 +0000 (-0700) Subject: Setup UI - Display "Administrator" options (on standalone) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8d92cfc696c06c9e79edb8d75fbc5f984f1d868a;p=civicrm-core.git Setup UI - Display "Administrator" options (on standalone) --- diff --git a/setup/plugins/blocks/admin.civi-setup.php b/setup/plugins/blocks/admin.civi-setup.php new file mode 100644 index 0000000000..6eb72e0b0b --- /dev/null +++ b/setup/plugins/blocks/admin.civi-setup.php @@ -0,0 +1,32 @@ +addListener('civi.setupui.boot', function (\Civi\Setup\UI\Event\UIBootEvent $e) { + \Civi\Setup::log()->info(sprintf('[%s] Register blocks', basename(__FILE__))); + + /** + * @var \Civi\Setup\UI\SetupController $ctrl + */ + $ctrl = $e->getCtrl(); + + $ctrl->blocks['admin'] = [ + 'is_active' => ($e->getModel()->cms === 'Standalone'), + 'file' => __DIR__ . DIRECTORY_SEPARATOR . 'admin.tpl.php', + 'class' => 'if-no-errors', + 'weight' => 35, + ]; + + if ($ctrl->blocks['admin']['is_active'] && $e->getMethod() === 'POST') { + if ($e->getField('adminUser')) { + $e->getModel()->extras['adminUser'] = $e->getField('adminUser'); + } + if ($e->getField('adminPass')) { + $e->getModel()->extras['adminPassWasSpecified'] = TRUE; + $e->getModel()->extras['adminPass'] = $e->getField('adminPass'); + } + } + + }, \Civi\Setup::PRIORITY_PREPARE); diff --git a/setup/plugins/blocks/admin.tpl.php b/setup/plugins/blocks/admin.tpl.php new file mode 100644 index 0000000000..5b3f33feeb --- /dev/null +++ b/setup/plugins/blocks/admin.tpl.php @@ -0,0 +1,14 @@ + + +

+ +

+ + +

+ +

+ + +