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 5 hours ago









      Andy BurnsAndy Burns

      584311




      584311






















          2 Answers
          2






          active

          oldest

          votes


















          2














          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
            3 hours ago



















          1














          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






          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









            2














            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
              3 hours ago
















            2














            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
              3 hours ago














            2












            2








            2







            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 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



















            • 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











            1














            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






            share|improve this answer




























              1














              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






              share|improve this answer


























                1












                1








                1







                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






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


                HTH



                Pradeep







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 hours ago









                Pradeep NayakPradeep Nayak

                10.1k1519




                10.1k1519






























                    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

                    Усть-Каменогорск

                    Халкинская богословская школа

                    Where does the word Sparryheid come from and mean?