Commit 0380b23c authored by Kevin Cristiano's avatar Kevin Cristiano 🌎

Merge branch 'fix' into 'cau'

Fix

See merge request !19
parents b468c52b b8a9c605
......@@ -139,44 +139,65 @@ function csshelper_civicrm_preProcess($formName, &$form) {
*/
/*Enqueue default CiviCRM CSS in admin. Create a filter to allow themes and other plugins to overrride */
if ( ! function_exists( 'civi_wp' ) ) {
}
else {
add_action('admin_enqueue_scripts', 'csshelper_register_admin_civicrm_styles');
};
function csshelper_register_admin_civicrm_styles() {
$tc_civi_css_admin = (plugin_dir_url('civicrm') . 'civicrm/civicrm/css/civicrm.css');
$tc_civi_css_admin = apply_filters('tc_civicss_override_admin', $tc_civi_css_admin);
wp_enqueue_style ('tad_admin_civicrm', $tc_civi_css_admin );
}
/**
* Disable CiviCRM's default CSS on front end.
*/
function csshelper_deregister_civicrm_default_styles() {
/*Enqueue default CiviCRM CSS on Front End. Do this so we can use wp_enqueue_style as opposed to the way civicrm forces its styles to load the Drupal way in WP*/
if ( ! function_exists( 'civi_wp' ) ) {
}
else {
// Bail if admin.
if ( is_admin() ) return;
add_action('wp_print_styles', 'csshelper_register_default_civicrm_styles', 100);
};
// Bail if CAU has disabled public CSS.
if ( csshelper_cau_has_disabled_css() ) return;
function csshelper_register_default_civicrm_styles() {
$tc_civi_css_default = (plugin_dir_url('civicrm') . 'civicrm/civicrm/css/civicrm.css');
$tc_civi_css_default = apply_filters('tc_civicss_override_default', $tc_civi_css_default);
wp_enqueue_style ('tad_default_civicrm', $tc_civi_css_default );
}
// Disable natively.
$url = CRM_Core_Resources::singleton()->getUrl( 'civicrm', 'css/civicrm.css', TRUE );
$registration = CRM_Core_Region::instance( 'html-header' )->get( $url );
if ( ! empty( $registration ) ) {
CRM_Core_Region::instance('html-header')->update( $url, array( 'disabled' => TRUE ) );
}
/*Enqueue custom CiviCRM CSS in front end of site. Create a filter to allow themes and other plugins to overrride */
if ( ! function_exists( 'civi_wp' ) ) {
}
else {
add_action('wp_print_styles', 'csshelper_register_civicrm_styles', 110);
};
if ( function_exists( 'civi_wp' ) ) {
add_action( 'wp_head', 'csshelper_deregister_civicrm_default_styles', 9 );
}
/**
* Enqueue scripts & styles.
*/
function csshelper_register_default_civicrm_styles() {
function csshelper_register_civicrm_styles() {
// Bail if CAU has disabled public CSS.
if ( csshelper_cau_has_disabled_css() ) return;
// Start by enqueuing default CSS.
$tc_civi_css_default = CRM_Core_Resources::singleton()->getUrl( 'civicrm', 'css/civicrm.css', TRUE );
$tc_civi_css_default = apply_filters('tc_civicss_override_default', $tc_civi_css_default);
wp_enqueue_style( 'tad_default_civicrm', $tc_civi_css_default );
// Next enqueue custom ones.
$tc_ext_url = CRM_Core_Resources::singleton()->getUrl('cc.tadpole.csshelper');
$tc_civi_css = ( $tc_ext_url . 'css/tad-civicrm.css') ;
$tc_civi_css = apply_filters ( 'tc_civicss_override' , $tc_civi_css ) ;
wp_enqueue_style ('tad_civicrm', $tc_civi_css );
}
\ No newline at end of file
$tc_civi_css = apply_filters( 'tc_civicss_override', $tc_civi_css );
wp_enqueue_style( 'tad_civicrm', $tc_civi_css, array('tad_default_civicrm') );
}
if ( function_exists( 'civi_wp' ) ) {
add_action('wp_enqueue_scripts', 'csshelper_register_default_civicrm_styles', 100);
}
/**
* Check if CAU has disabled Default CSS on front end.
*/
function csshelper_cau_has_disabled_css() {
// If there's no CAU, it can't have done so.
if ( ! function_exists('civicrm_au') ) return false;
// Get setting and return as boolean.
$disabled = civicrm_au()->single->setting_get( 'css_admin', '0' );
return ($disabled == '1') ? true : false;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment