From 6e7adedc1b5348e617d28fd9a94ba9b6681f4f93 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 17 Aug 2020 23:44:28 -0700 Subject: [PATCH] CRM_Core_Resources - Define 'bootstrap3' bundle --- CRM/Core/Resources/Common.php | 19 +++++++++++++++++++ Civi/Core/Container.php | 3 +++ 2 files changed, 22 insertions(+) diff --git a/CRM/Core/Resources/Common.php b/CRM/Core/Resources/Common.php index e5f34cc1d9..df5328932a 100644 --- a/CRM/Core/Resources/Common.php +++ b/CRM/Core/Resources/Common.php @@ -16,6 +16,25 @@ class CRM_Core_Resources_Common { const REGION = 'html-header'; + /** + * The 'bundle.bootstrap3' service is a collection of resources which are + * loaded when a page needs to support Boostrap CSS v3. + * + * @param string $name + * i.e. 'bootstrap3' + * @return \CRM_Core_Resources_Bundle + */ + public static function createBootstrap3Bundle($name) { + $bundle = new CRM_Core_Resources_Bundle($name); + $bundle->addStyleFile('civicrm', 'css/bootstrap3.css'); + $bundle->addScriptFile('civicrm', 'js/bootstrap3.js', [ + 'translate' => FALSE, + ]); + CRM_Utils_Hook::alterBundle($bundle); + self::useRegion($bundle, self::REGION); + return $bundle; + } + /** * The 'bundle.coreStyles' service is a collection of resources used on some * non-Civi pages (wherein Civi may be mixed-in). diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 5a36afacf4..a0bf207032 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -206,6 +206,9 @@ class Container { [] ))->setPublic(TRUE); + $container->setDefinition('bundle.bootstrap3', new Definition('CRM_Core_Resources_Bundle', ['bootstrap3'])) + ->setFactory('CRM_Core_Resources_Common::createBootstrap3Bundle'); + $container->setDefinition('bundle.coreStyles', new Definition('CRM_Core_Resources_Bundle', ['coreStyles'])) ->setFactory('CRM_Core_Resources_Common::createStyleBundle'); -- 2.25.1