1

Using Drupal 7 and CIVI CRM 5.x on windows 10 and Xampp

I can set this up in custom fields sets, but how do I set the native "tags and groups" field to expanded on initial display?

enter image description here

4

To add on to @oskylark answer I would use an extra template instead of a duplicate. Easier to manage when upgrading. https://civicrm.org/blog/dave-greenberg/now-its-easier-add-custom-behaviors-templates

In the extra template (TagsAndGroups.extra.tpl) and you could throw some javascript in a {literal} tag along the lines of

cj('.crm-tagGroup-accordion').collapse('toggle');

NOTE: I did not test this js line, just a first guess.

  • Yes, that would work, but I would need the exact code, not just a "first guess" ;) I'll wait and see if a pro provide the code...!Thanks Ray;) – Bruno Vincent Aug 3 '18 at 0:55
  • Maybe I should have said a 'first pass'. I'm not able to do the testing for you but I'd imagine the line is close. I can share links to references on jquery collapse is you need. – RayWright Aug 3 '18 at 1:00
  • That would be great, I'm learning JS now, so would be a good exercise for me;) – Bruno Vincent Aug 3 '18 at 1:04
  • The civicrm blog link will have the details on using the {literal} tag in a template file - you need those to utilize javascript. (cj is what I'm accustomed to but I believe it is the older way of calling javascript in Civi, you may be able to use CRM.$ instead.) W3 schools usually has good references and examples - in this one: w3schools.com/bootstrap/bootstrap_ref_js_collapse.asp they explain collapse and toggle an give an example of target a div thru class. – RayWright Aug 3 '18 at 1:39
2

In your custom Civi templates folder (probably default/civicrm/templates) place a copy of the following file from the civicrm module: /civicrm/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl

Edit that file, look for the following line and remove the "collapsed" class:

<div class="crm-accordion-wrapper crm-tagGroup-accordion collapsed">

No doubt it could also be done without the need of a custom version of this template file by using a couple of lines of jQuery, as long as they run after the initial page load scripts have run. I'll leave that option for a separate answer. Update: see @RayWright's answer, that's how to do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.