Adding CSS to extra tpl file

Multi tool use
I've added CSS to a Summary.extra.tpl file to change reports. But the CSS does not apply.
Adding the CSS by itself crashes the report (character encoding issue) so adding the {literal} tag is what I have.
{literal}
#s2id_groups {display:none;}
{/literal}
I am trying to remove the add contacts to group dropdown.
css custom-templates
add a comment |
I've added CSS to a Summary.extra.tpl file to change reports. But the CSS does not apply.
Adding the CSS by itself crashes the report (character encoding issue) so adding the {literal} tag is what I have.
{literal}
#s2id_groups {display:none;}
{/literal}
I am trying to remove the add contacts to group dropdown.
css custom-templates
add a comment |
I've added CSS to a Summary.extra.tpl file to change reports. But the CSS does not apply.
Adding the CSS by itself crashes the report (character encoding issue) so adding the {literal} tag is what I have.
{literal}
#s2id_groups {display:none;}
{/literal}
I am trying to remove the add contacts to group dropdown.
css custom-templates
I've added CSS to a Summary.extra.tpl file to change reports. But the CSS does not apply.
Adding the CSS by itself crashes the report (character encoding issue) so adding the {literal} tag is what I have.
{literal}
#s2id_groups {display:none;}
{/literal}
I am trying to remove the add contacts to group dropdown.
css custom-templates
css custom-templates
asked 5 hours ago
Andy BurnsAndy Burns
584311
584311
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You might be able to do it with css but I might use jquery instead:
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('#s2id_groups').hide();
});
</script>
{/literal}
The problem with css might also be that you don't have a <style type="text/css">
tag around your css?
Thanks Demerit. Adding the style tag was needed. I haven't done much with these tpl files so great to know what is needed.
– Andy Burns
3 hours ago
add a comment |
There are 3 solutions on how to achieve this
1 - Adding Javascript in tpl file as mentioned by Demerit
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('.crm-report-form-block select[name="groups"]').closest('td').hide();
});
</script>
{/literal}
2 - Adding a code using buildForm hook in an extension
function membershipapproval_civicrm_buildForm($formName, &$form) {
// unset from all reports
// Change if condition to $formName == 'CRM_Report_Form_Event/Summary'
// if want to hide on specific event
if (get_parent_class($form) == 'CRM_Report_Form') {
$groupsElementIndex = CRM_Utils_Array::value('groups', $form->_elementIndex);
if ($groupsElementIndex) {
unset($form->_elements[$groupsElementIndex]);
}
}
}
HTH
Pradeep
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "605"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcivicrm.stackexchange.com%2fquestions%2f28079%2fadding-css-to-extra-tpl-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You might be able to do it with css but I might use jquery instead:
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('#s2id_groups').hide();
});
</script>
{/literal}
The problem with css might also be that you don't have a <style type="text/css">
tag around your css?
Thanks Demerit. Adding the style tag was needed. I haven't done much with these tpl files so great to know what is needed.
– Andy Burns
3 hours ago
add a comment |
You might be able to do it with css but I might use jquery instead:
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('#s2id_groups').hide();
});
</script>
{/literal}
The problem with css might also be that you don't have a <style type="text/css">
tag around your css?
Thanks Demerit. Adding the style tag was needed. I haven't done much with these tpl files so great to know what is needed.
– Andy Burns
3 hours ago
add a comment |
You might be able to do it with css but I might use jquery instead:
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('#s2id_groups').hide();
});
</script>
{/literal}
The problem with css might also be that you don't have a <style type="text/css">
tag around your css?
You might be able to do it with css but I might use jquery instead:
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('#s2id_groups').hide();
});
</script>
{/literal}
The problem with css might also be that you don't have a <style type="text/css">
tag around your css?
answered 3 hours ago
DemeritDemerit
3,1841518
3,1841518
Thanks Demerit. Adding the style tag was needed. I haven't done much with these tpl files so great to know what is needed.
– Andy Burns
3 hours ago
add a comment |
Thanks Demerit. Adding the style tag was needed. I haven't done much with these tpl files so great to know what is needed.
– Andy Burns
3 hours ago
Thanks Demerit. Adding the style tag was needed. I haven't done much with these tpl files so great to know what is needed.
– Andy Burns
3 hours ago
Thanks Demerit. Adding the style tag was needed. I haven't done much with these tpl files so great to know what is needed.
– Andy Burns
3 hours ago
add a comment |
There are 3 solutions on how to achieve this
1 - Adding Javascript in tpl file as mentioned by Demerit
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('.crm-report-form-block select[name="groups"]').closest('td').hide();
});
</script>
{/literal}
2 - Adding a code using buildForm hook in an extension
function membershipapproval_civicrm_buildForm($formName, &$form) {
// unset from all reports
// Change if condition to $formName == 'CRM_Report_Form_Event/Summary'
// if want to hide on specific event
if (get_parent_class($form) == 'CRM_Report_Form') {
$groupsElementIndex = CRM_Utils_Array::value('groups', $form->_elementIndex);
if ($groupsElementIndex) {
unset($form->_elements[$groupsElementIndex]);
}
}
}
HTH
Pradeep
add a comment |
There are 3 solutions on how to achieve this
1 - Adding Javascript in tpl file as mentioned by Demerit
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('.crm-report-form-block select[name="groups"]').closest('td').hide();
});
</script>
{/literal}
2 - Adding a code using buildForm hook in an extension
function membershipapproval_civicrm_buildForm($formName, &$form) {
// unset from all reports
// Change if condition to $formName == 'CRM_Report_Form_Event/Summary'
// if want to hide on specific event
if (get_parent_class($form) == 'CRM_Report_Form') {
$groupsElementIndex = CRM_Utils_Array::value('groups', $form->_elementIndex);
if ($groupsElementIndex) {
unset($form->_elements[$groupsElementIndex]);
}
}
}
HTH
Pradeep
add a comment |
There are 3 solutions on how to achieve this
1 - Adding Javascript in tpl file as mentioned by Demerit
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('.crm-report-form-block select[name="groups"]').closest('td').hide();
});
</script>
{/literal}
2 - Adding a code using buildForm hook in an extension
function membershipapproval_civicrm_buildForm($formName, &$form) {
// unset from all reports
// Change if condition to $formName == 'CRM_Report_Form_Event/Summary'
// if want to hide on specific event
if (get_parent_class($form) == 'CRM_Report_Form') {
$groupsElementIndex = CRM_Utils_Array::value('groups', $form->_elementIndex);
if ($groupsElementIndex) {
unset($form->_elements[$groupsElementIndex]);
}
}
}
HTH
Pradeep
There are 3 solutions on how to achieve this
1 - Adding Javascript in tpl file as mentioned by Demerit
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('.crm-report-form-block select[name="groups"]').closest('td').hide();
});
</script>
{/literal}
2 - Adding a code using buildForm hook in an extension
function membershipapproval_civicrm_buildForm($formName, &$form) {
// unset from all reports
// Change if condition to $formName == 'CRM_Report_Form_Event/Summary'
// if want to hide on specific event
if (get_parent_class($form) == 'CRM_Report_Form') {
$groupsElementIndex = CRM_Utils_Array::value('groups', $form->_elementIndex);
if ($groupsElementIndex) {
unset($form->_elements[$groupsElementIndex]);
}
}
}
HTH
Pradeep
answered 2 hours ago


Pradeep NayakPradeep Nayak
10.1k1519
10.1k1519
add a comment |
add a comment |
Thanks for contributing an answer to CiviCRM Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcivicrm.stackexchange.com%2fquestions%2f28079%2fadding-css-to-extra-tpl-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
EiSFU30c,yFToEPCT47Oj t mnrkw,sCYBIW8tGxZCk0xIlPIMWqFGL,el6l0,xU eaC999BVh,O1c48LtP N,y2nMZU