From 94f35fe9df0930eafa758e2a5b20f7672b5b0247 Mon Sep 17 00:00:00 2001 From: Coleman Watts <coleman@civicrm.org> Date: Thu, 31 Oct 2013 13:50:20 -0700 Subject: [PATCH] CRM-12578 - Add configuration to disable civicrm.css. Deprecate extras.css. --- CRM/Admin/Form/Setting/Url.php | 1 + CRM/Core/Resources.php | 3 ++- css/extras.css | 12 +++++------- settings/Url.setting.php | 17 +++++++++++++++-- templates/CRM/Admin/Form/Setting/Url.tpl | 9 +++++++++ 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/CRM/Admin/Form/Setting/Url.php b/CRM/Admin/Form/Setting/Url.php index dbd4f2035e..5ac5fffd82 100644 --- a/CRM/Admin/Form/Setting/Url.php +++ b/CRM/Admin/Form/Setting/Url.php @@ -40,6 +40,7 @@ class CRM_Admin_Form_Setting_Url extends CRM_Admin_Form_Setting { protected $_settings = array( 'cvv_backoffice_required' => CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, + 'disable_core_css' => CRM_Core_BAO_Setting::URL_PREFERENCES_NAME, ); /** * Function to build the form diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index d2e79f229e..af15e33c0d 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -493,8 +493,9 @@ class CRM_Core_Resources { if (!empty($config->customCSSURL)) { $this->addStyleUrl($config->customCSSURL, -99, $region); } - else { + if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::URL_PREFERENCES_NAME, 'disable_core_css')) { $this->addStyleFile('civicrm', 'css/civicrm.css', -99, $region); + // extras.css is deprecated. Don't use it. $this->addStyleFile('civicrm', 'css/extras.css', -98, $region); } } diff --git a/css/extras.css b/css/extras.css index 248387ddd9..72a92580c3 100644 --- a/css/extras.css +++ b/css/extras.css @@ -1,7 +1,5 @@ -/* $Id$ */ - -/* -** Put your local CSS modifications in this file -** if you don't want to modify system provided -** civicrm.css. -*/ +/** + * @deprecated + * This file is deprecated and support will be removed for it in version 4.5 + * Don't use it. Instead configure a custom css url at /civicrm/admin/setting/url?reset=1 + */ diff --git a/settings/Url.setting.php b/settings/Url.setting.php index 46decc3bab..f1faea0946 100644 --- a/settings/Url.setting.php +++ b/settings/Url.setting.php @@ -78,6 +78,19 @@ return array ( 'help_text' => null, 'validate_callback' => 'CRM_Utils_Rule::url', ), + 'disable_core_css' => array( + 'group' => 'UrlPreferences', + 'group_name' => 'url', + 'name' => 'disableCoreCSS', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => '0', + 'add' => '4.4', + 'title' => 'Disable CiviCRM css', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If you enable this option, the stylesheet "civicrm.css" will not be loaded. You will have to provide your own css to theme CiviCRM', + 'help_text' => NULL, + ), - - ); +); diff --git a/templates/CRM/Admin/Form/Setting/Url.tpl b/templates/CRM/Admin/Form/Setting/Url.tpl index 3f8a81c465..1ab579b442 100644 --- a/templates/CRM/Admin/Form/Setting/Url.tpl +++ b/templates/CRM/Admin/Form/Setting/Url.tpl @@ -53,6 +53,15 @@ {$form.customCSSURL.html|crmAddClass:'huge40'} {help id='id-css_url'} </td> </tr> + <tr class="crm-url-form-block-disable_core_css"> + <td class="label"> + {$form.disable_core_css.label} + </td> + <td> + {$form.disable_core_css.html}<br /> + <p class="description">{ts}{$disable_core_css_description}{/ts}</p> + </td> + </tr> <tr class="crm-url-form-block-extensionsURL"> <td class="label"> {$form.extensionsURL.label} -- GitLab