Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
cc.tadpole.csshelper
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
extensions
cc.tadpole.csshelper
Commits
0380b23c
Commit
0380b23c
authored
Dec 17, 2018
by
Kevin Cristiano
🌎
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix' into 'cau'
Fix See merge request
!19
parents
b468c52b
b8a9c605
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
31 deletions
+52
-31
csshelper.php
csshelper.php
+52
-31
No files found.
csshelper.php
View file @
0380b23c
...
...
@@ -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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment