Adding CSS to extra tpl file












1















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.



enter image description here










share|improve this question



























    1















    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.



    enter image description here










    share|improve this question

























      1












      1








      1








      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.



      enter image description here










      share|improve this question














      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.



      enter image description here







      css custom-templates






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 15 at 21:44









      Andy BurnsAndy Burns

      654411




      654411






















          2 Answers
          2






          active

          oldest

          votes


















          3














          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?






          share|improve this answer
























          • 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
            Jan 16 at 0:10



















          2














          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]);
          }
          }
          }


          3 - Adding CSS in tpl file as



          {literal}
          <style type="text/css">
          #s2id_groups {
          display:none;
          }
          </style>
          {/literal}


          HTH



          Pradeep






          share|improve this answer

























            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
            });


            }
            });














            draft saved

            draft discarded


















            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









            3














            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?






            share|improve this answer
























            • 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
              Jan 16 at 0:10
















            3














            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?






            share|improve this answer
























            • 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
              Jan 16 at 0:10














            3












            3








            3







            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?






            share|improve this answer













            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?







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 15 at 23:24









            DemeritDemerit

            3,3162518




            3,3162518













            • 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
              Jan 16 at 0:10



















            • 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
              Jan 16 at 0:10

















            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
            Jan 16 at 0:10





            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
            Jan 16 at 0:10











            2














            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]);
            }
            }
            }


            3 - Adding CSS in tpl file as



            {literal}
            <style type="text/css">
            #s2id_groups {
            display:none;
            }
            </style>
            {/literal}


            HTH



            Pradeep






            share|improve this answer






























              2














              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]);
              }
              }
              }


              3 - Adding CSS in tpl file as



              {literal}
              <style type="text/css">
              #s2id_groups {
              display:none;
              }
              </style>
              {/literal}


              HTH



              Pradeep






              share|improve this answer




























                2












                2








                2







                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]);
                }
                }
                }


                3 - Adding CSS in tpl file as



                {literal}
                <style type="text/css">
                #s2id_groups {
                display:none;
                }
                </style>
                {/literal}


                HTH



                Pradeep






                share|improve this answer















                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]);
                }
                }
                }


                3 - Adding CSS in tpl file as



                {literal}
                <style type="text/css">
                #s2id_groups {
                display:none;
                }
                </style>
                {/literal}


                HTH



                Pradeep







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 16 at 16:25

























                answered Jan 16 at 0:18









                Pradeep NayakPradeep Nayak

                11.1k1520




                11.1k1520






























                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Questions related to Moebius Transform of Characteristic Function of the Primes

                    List of scandals in India

                    Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?