Answers.Body: <p>You can hide some of them via the UI at <strong>Administer > Customize Data and Screens > Display Preferences</strong></p>
  
  <p>e.g. <a href="http://d46.demo.civicrm.org/civicrm/admin/setting/preferences/display?reset=1" rel="noreferrer">http://d46.demo.civicrm.org/civicrm/admin/setting/preferences/display?reset=1</a></p>
  
  <p><a href="https://i.sstatic.net/3qwTG.jpg" rel="noreferrer"><img src="https://i.sstatic.net/3qwTG.jpg" alt="Display Preferences"></a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-05T19:05:10.140Z
Answers.LastActivityDate: 2016-02-05T20:28:50.117Z
Answers.LastEditDate: 2016-02-05T20:28:50.117Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>The new Extension called <a href="https://github.com/civicrm/org.civicrm.contactlayout" rel="noreferrer">Contact Summary Layout Editor</a> is a new tool that may help folk dealing with this type of problem</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-21T04:36:40.217Z
Answers.LastActivityDate: 2018-07-21T04:36:40.217Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>I believe you can create a modified version of the default contact page templates <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in,+Profile,+Contribution+and+Event+Registration+Screens" rel="nofollow">as described here</a>.</p>
  
  <p><em>Excerpt from that page:</em></p>
  
  <blockquote>
    <p>These steps are for any "built-in" screen (e.g. the Contact Summary
    screen)...</p>
    
    <ul>
    <li>Navigate to the screen you want to customize and use your browser to View Source.</li>
    <li>Search for ".tpl" in the source. You will find a comment line which gives you the path and name of the template used for the screen you
    are viewing.</li>
    </ul>
    
    <p><code>&lt;!-- .tpl file invoked: CRM/Contact/Page/View/Summary.tpl. Call via
    form.tpl if we have a form in the page. --&gt;</code></p>
    
    <ul>
    <li><p>Locate this file on your server under your ../civicrm/templates path. Make a copy of file in the equivalent path under your new custom
    templates directory.</p></li>
    <li><p>Edit the file as needed and save.</p></li>
    <li>Then clean-up the compiled templates directory, usually by deleting all the directories under your templates_c directory. You can also do
    the cleanup by enabling CiviCRM debugging and running the directory
    cleanup command. (NOTE: You do NOT need to delete the standard version
    of the template from your main CiviCRM codebase. CiviCRM will look for
    a customized version first, and use that one if found.)</li>
    <li>You should see your modified version when you reload the CiviCRM screen. If you need help with the templating language, check out the
    <a href="http://www.smarty.net/" rel="nofollow">Smarty Documentation</a></li>
    </ul>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-09T13:14:13.313Z
Answers.Text: Thanks. Maybe I'll do this at some places but because those fields happen to be displayed in various contexts I hope with js/jquery I'll be able to catch some more occurences in a single place.
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-05T17:16:03.267Z
Answers.LastActivityDate: 2016-02-05T17:16:03.267Z
Answers.UserDisplayName: Laryn
Answers.Body: <p>Some example code if you want to remove certain elements on the contact add and edit forms:</p>
  <pre><code>/**
   * Implements hook_civicrm_buildForm().
   *
   * Changes some fields on the add and update contact forms
   *
   * @param string $formName
   * @param CRM_Core_Form $form
   */
  function MODULE_civicrm_buildForm($formName, &amp;$form) {
    // print_r($formName);
    if ($formName == 'CRM_Contact_Form_Contact') {
      if (($form-&gt;getAction() == CRM_Core_Action::ADD) || ($form-&gt;getAction() == CRM_Core_Action::UPDATE)) {
        // print_r($form);
        // Add a javascript file for changes in display
        CRM_Core_Resources::singleton()-&gt;addScriptUrl('https://EXAMPLE.ORG/sites/all/themes/EXAMPLE/EXAMPLE.js');
  
        // Remove field override geocoding
        for ($i = 0; $i &lt;= 5; $i++) {
          if ($form-&gt;elementExists('address[' . $i . '][manual_geo_code]')) {
            $form-&gt;removeElement('address[' . $i . '][manual_geo_code]');
            // $element = &amp;$form-&gt;getElement('address[1][manual_geo_code]');
            // crm_Core_error::debug( 'options', $element-&gt;_options );
            // also you can add new options w/ $element-&gt;addOption( );
          }
        }
  
        // Remove field signature text
        for ($i = 0; $i &lt;= 5; $i++) {
          if ($form-&gt;elementExists('email[' . $i . '][signature_text]')) {
            $form-&gt;removeElement('email[' . $i . '][signature_text]');
          }
        }
  
        // Remove field signature html
        for ($i = 0; $i &lt;= 5; $i++) {
          if ($form-&gt;elementExists('email[' . $i . '][signature_html]')) {
            $form-&gt;removeElement('email[' . $i . '][signature_html]');
          }
        }
  
        // Remove field external id
        if ($form-&gt;elementExists('external_identifier')) {
          $form-&gt;removeElement('external_identifier');
        }
  
        // Remove field nickname
        if ($form-&gt;elementExists('nick_name')) {
          $form-&gt;removeElement('nick_name');
        }
  
        if ($form-&gt;getAction() == CRM_Core_Action::ADD) {
          // we can get the contact type from the url ct parameter: Individual/household/organisation
          $contactType = CRM_Utils_Array::value('ct', $_GET, '0');
        }
  
        elseif ($form-&gt;getAction() == CRM_Core_Action::UPDATE) {
          // there is no info in the url so we need to use the contact id and check
          $contactId = CRM_Utils_Array::value('cid', $_GET, '0');
          if ($contactId != 0) {
            $contactType = CRM_Contact_BAO_Contact::getContactType($contactId);
            // $subType = CRM_Contact_BAO_Contact::getContactSubType($contactId);
          }
        }
  
        // Household
        if ($contactType == 'Household') {
          // Remove custom block
          unset($form-&gt;_groupTree[3]);
          // Remove custom block
          unset($form-&gt;_groupTree[7]);
          // Change label of household name
          if ($form-&gt;elementExists('household_name')) {
            $element = &amp;$form-&gt;getElement('household_name');
            $element-&gt;setLabel('NEW LABEL');
          }
        }
        elseif ($contactType == 'Organization') {
          // Remove custom block
          unset($form-&gt;_groupTree[1]);
          // Remove custom block
          unset($form-&gt;_groupTree[7]);
          if ($form-&gt;elementExists('sic_code')) {
            $form-&gt;removeElement('sic_code');
          }
        }
        else {
          // Individual
        }
      }
    }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-17T17:56:46.083Z
Answers.Text: Thanks. Unfortunately I'm afraid that this is too much afford if we take the frontend migration plans of civicrm into account.
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-18T19:30:08.147Z
Answers.Text: I'm not sure what you mean with "too much effort". First: this code does a lot more than just remove a simple "nickname" field. Second: the effort of writing code becomes very little once you know how to do it and I think this is a nice example how to do it in a way that targets in a futureproof way the right fields without creating issues with future upgrades of civi.
Answers.UserDisplayName: Hans Rossel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-21T07:33:25.270Z
Answers.Text: I'm sorry, I did not want to question your approach in general. It's just I'm not trusting this old form builder stuff to be future proof.
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-16T19:51:25.317Z
Answers.LastActivityDate: 2020-09-16T19:51:25.317Z
Answers.UserDisplayName: Hans Rossel
Answers.Body: <p>Building on <a href="https://civicrm.stackexchange.com/a/37689/">Hans Rossel</a>'s helpful answer, below are paired PHP and javascript to remove some contact fields when adding or editing contacts.</p>
  <p>Note there is a WordPress-specific function call to obtain the path to the javascript file, which I assume is stored in the <code>.../plugins/CUSTOMPLUGIN/assets/</code> folder, with a <code>define('WP_CUSTOMPLUGIN_FILE', __FILE__);</code> directive in the main plugin PHP file.</p>
  <p><strong>PHP hook</strong></p>
  
  <pre><code>
  /**
   * Implements hook_civicrm_buildForm().
   *
   * Changes some fields on the add and update contact forms
   *
   * @param string $formName
   * @param CRM_Core_Form $form
   */
  function MODULE_civicrm_buildForm($formName, &amp;$form) {
      if ($formName !== 'CRM_Contact_Form_Contact') {
          return;
      }
      if (($form-&gt;getAction() !== CRM_Core_Action::ADD) &amp;&amp; ($form-&gt;getAction() !== CRM_Core_Action::UPDATE)) {
          return;
      }
      // ***WORDPRESS-SPECIFIC: javascript for contacts edit page
      $jsUrl = plugins_url('assets/cv_editcntct.js', WP_CUSTOMPLUGIN_FILE);
      CRM_Core_Resources::singleton()-&gt;addScriptUrl($jsUrl);
  
      // Remove some address fields
      for ($i = 0; $i &lt;= 5; $i++) {
          // geocoding
          if ($form-&gt;elementExists('address[' . $i . '][geo_code_1]')) {
              $form-&gt;removeElement('address[' . $i . '][geo_code_1]');
              $form-&gt;removeElement('address[' . $i . '][geo_code_2]');
          }
  
          // county
          if ($form-&gt;elementExists('address[' . $i . '][county_id]')) {
              $form-&gt;removeElement('address[' . $i . '][county_id]');
          }
      }
  
      // See also cv_editcntct.js
      for ($i = 0; $i &lt;= 5; $i++) {
          // Remove field signature text
          if ($form-&gt;elementExists('email[' . $i . '][signature_text]')) {
                  $form-&gt;removeElement('email[' . $i . '][signature_text]');
          }
          // Remove field signature html
          if ($form-&gt;elementExists('email[' . $i . '][signature_html]')) {
                  $form-&gt;removeElement('email[' . $i . '][signature_html]');
          }
      }
  
      if ($form-&gt;elementExists('employer_id')) {
          $form-&gt;removeElement('employer_id');
      }
      if ($form-&gt;elementExists('job_title')) {
          $form-&gt;removeElement('job_title');
      }
      if ($form-&gt;elementExists('image_URL')) {
          $form-&gt;removeElement('image_URL');
      }
  
      $contactType = NULL;
      if ($form-&gt;getAction() == CRM_Core_Action::ADD) {
          // we can get the contact type from the url ct parameter: Individual/household/organisation
          $contactType = CRM_Utils_Array::value('ct', $_GET, '0');
      }
      elseif ($form-&gt;getAction() == CRM_Core_Action::UPDATE) {
          // there is no info in the url so we need to use the contact id and check
          $contactId = CRM_Utils_Array::value('cid', $_GET, '0');
          if ($contactId != 0) {
              $contactType = CRM_Contact_BAO_Contact::getContactType($contactId);
              //$subType = CRM_Contact_BAO_Contact::getContactSubType($contactId);
          }
      }
  
      // Adjustments specific to contact type...
      if ($contactType == 'Household') {
          // no Household customizations
      }
      elseif ($contactType == 'Organization') {
          // // Remove custom block
          // unset($form-&gt;_groupTree[1]);
          if ($form-&gt;elementExists('sic_code')) {
              $form-&gt;removeElement('sic_code');
          }
      }
      else {
          // Individual
          // // Remove field nickname
          // if ($form-&gt;elementExists('nick_name')) {
          //  $form-&gt;removeElement('nick_name');
          // }
      }
  }
  </code></pre>
  <p><strong>Javascript</strong> <code>cv_editcntct.js</code> <strong>file</strong></p>
  
  <pre><code>(function($, undefined){
      //console.log('hello from cv_editcntct.js');
  
      // for individual: employer and job title has been removed
      // adjust layout with or without nickname
      var $st = $('#contact_sub_type');
      var $nn = $st.closest('tr').find('#nick_name');
      if ($nn.length) {
          // remove all (empty) TD cells prior to nickname and adjust width
          var $td = $nn.closest('td').attr('colspan','2');
          $td.prevAll().remove();
          $nn.css('width',$td.width()+'px');
          // also adjust subtype width
          $td = $st.closest('td').attr('colspan','3');
          $st.css('width',$td.width()+'px');
      } else {
          // remove empty TD cells before subtype, and adjust subtype width
          var $td = $st.closest('td').attr('colspan','3');
          $td.prevAll().remove();
          $st.css('width',$td.width()+'px');
      }
      
      // remove (empty) image URL section (table)
      $('table.image_URL-section').remove();
  
      // remove (empty) signature blocks
      $('.email-signature.crm-collapsible').remove();
      // since new emails can be added, monitor the DOM for added elements 
      // and remove signature blocks
      $emailSection = $('.crm-section.contact_information-section');
      if ($emailSection.length) {
          // Callback function to execute when mutations are observed
          const callback = function(mutationsList, observer) {
              // Use traditional 'for loops' for IE 11
              var bAdded = false;
              for (const mutation of mutationsList) {
                  if (mutation.addedNodes.length) {
                      bAdded = true;
                      break;
                  }
              }
              if (bAdded) {
                  // remove (empty) signature blocks
                  var $s = $('.email-signature.crm-collapsible');
                  if ($s.length) {
                      $s.remove();
                      console.log(&quot;Zapped a signature block!&quot;);
                  }
              }
          };
          // Create a DOM observer
          const observer = new MutationObserver(callback);
          // Start watching for element additions (or removals) in the email section
          observer.observe($emailSection.get(0), { childList: true, subtree: true }); 
      }
  
  })(jQuery);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-04T10:16:10.653Z
Answers.LastActivityDate: 2021-03-05T02:51:12.247Z
Answers.LastEditDate: 2021-03-05T02:51:12.247Z
Answers.UserDisplayName: Martin_W
Answers.Body: <p>The "hide-by-jquery-to-death" way is the way to go for now. (Great name :) )</p>
  
  <p>There are discussions to do that via the web interface in a future version, but that's not there yet.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-09T13:14:35.277Z
Answers.Text: Yap. I'm afraid, you're right.
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-05T10:19:47.410Z
Answers.LastActivityDate: 2016-02-05T10:19:47.410Z
Answers.UserDisplayName: Catorghans
Body: <p>My company does not make use of many of the fields provided by civicrm. Our users told me the sheer mass of empty fields is overwhelming them.</p>
  
  <p>I know I could walk the hide-by-jquery-to-death way, but:</p>
  
  <p>Is there a designated or recommended way to disable or hide civi core fields like "nickname" or "legal_name"?  </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-21T02:37:14.297Z
Comments.Text: Now 2018, going into 2019, still no answer on that feature?
Comments.UserDisplayName: Bruno  Vincent
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-21T04:31:12.473Z
Comments.Text: civicrm is largely built by the community - if the community have not provided a feature you want then perhaps not many folk are fussed enough to put together a solution. Hmm just remembered about the new extension so have added an answer
Comments.UserDisplayName: petednz - fuzion
Tags: <fields><core>
Title: Howto hide/disable fields not needed
ThreadText: # Howto hide/disable fields not needed
  
  (Asked by: username_0 on 2016-02-05)
  
  My company does not make use of many of the fields provided by civicrm. Our users told me the sheer mass of empty fields is overwhelming them.
  
  I know I could walk the hide-by-jquery-to-death way, but:
  
  Is there a designated or recommended way to disable or hide civi core fields like "nickname" or "legal\_name"?
  
  **Tags:** fields, core
  
  > **Comments:**
  > **username_1**: Now 2018, going into 2019, still no answer on that feature?  
  > **username_2**: civicrm is largely built by the community - if the community have not provided a feature you want then perhaps not many folk are fussed enough to put together a solution. Hmm just remembered about the new extension so have added an answer  
  
  ---
  
  ## 6 answers
  
  ### Answer by username_6 on 2016-02-05. Score: 4 | Accepted answer
  
  The "hide-by-jquery-to-death" way is the way to go for now. (Great name :) )
  
  There are discussions to do that via the web interface in a future version, but that's not there yet.
  
  > **Comments:**
  > **username_0**: Yap. I'm afraid, you're right.  
  
  ---
  
  ### Answer by username_2 on 2016-02-05. Score: 11
  
  You can hide some of them via the UI at **Administer > Customize Data and Screens > Display Preferences**
  
  e.g. <http://d46.demo.civicrm.org/civicrm/admin/setting/preferences/display?reset=1>
  
  [![Display Preferences](https://i.sstatic.net/3qwTG.jpg)](https://i.sstatic.net/3qwTG.jpg)
  
  
  ---
  
  ### Answer by username_2 on 2018-07-21. Score: 5
  
  The new Extension called [Contact Summary Layout Editor](https://github.com/civicrm/org.civicrm.contactlayout) is a new tool that may help folk dealing with this type of problem
  
  
  ---
  
  ### Answer by username_3 on 2016-02-05. Score: 3
  
  I believe you can create a modified version of the default contact page templates [as described here](https://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in,+Profile,+Contribution+and+Event+Registration+Screens).
  
  *Excerpt from that page:*
  
  > These steps are for any "built-in" screen (e.g. the Contact Summary
  > screen)...
  >
  > * Navigate to the screen you want to customize and use your browser to View Source.
  > * Search for ".tpl" in the source. You will find a comment line which gives you the path and name of the template used for the screen you
  >   are viewing.
  >
  > `<!-- .tpl file invoked: CRM/Contact/Page/View/Summary.tpl. Call via
  > form.tpl if we have a form in the page. -->`
  >
  > * Locate this file on your server under your ../civicrm/templates path. Make a copy of file in the equivalent path under your new custom
  >   templates directory.
  > * Edit the file as needed and save.
  > * Then clean-up the compiled templates directory, usually by deleting all the directories under your templates\_c directory. You can also do
  >   the cleanup by enabling CiviCRM debugging and running the directory
  >   cleanup command. (NOTE: You do NOT need to delete the standard version
  >   of the template from your main CiviCRM codebase. CiviCRM will look for
  >   a customized version first, and use that one if found.)
  > * You should see your modified version when you reload the CiviCRM screen. If you need help with the templating language, check out the
  >   [Smarty Documentation](http://www.smarty.net/)
  
  > **Comments:**
  > **username_0**: Thanks. Maybe I'll do this at some places but because those fields happen to be displayed in various contexts I hope with js/jquery I'll be able to catch some more occurences in a single place.  
  
  ---
  
  ### Answer by username_4 on 2020-09-16. Score: 2
  
  Some example code if you want to remove certain elements on the contact add and edit forms:
  
  ```
  /**
   * Implements hook_civicrm_buildForm().
   *
   * Changes some fields on the add and update contact forms
   *
   * @param string $formName
   * @param CRM_Core_Form $form
   */
  function MODULE_civicrm_buildForm($formName, &$form) {
    // print_r($formName);
    if ($formName == 'CRM_Contact_Form_Contact') {
      if (($form->getAction() == CRM_Core_Action::ADD) || ($form->getAction() == CRM_Core_Action::UPDATE)) {
        // print_r($form);
        // Add a javascript file for changes in display
        CRM_Core_Resources::singleton()->addScriptUrl('https://EXAMPLE.ORG/sites/all/themes/EXAMPLE/EXAMPLE.js');
  
        // Remove field override geocoding
        for ($i = 0; $i <= 5; $i++) {
          if ($form->elementExists('address[' . $i . '][manual_geo_code]')) {
            $form->removeElement('address[' . $i . '][manual_geo_code]');
            // $element = &$form->getElement('address[1][manual_geo_code]');
            // crm_Core_error::debug( 'options', $element->_options );
            // also you can add new options w/ $element->addOption( );
          }
        }
  
        // Remove field signature text
        for ($i = 0; $i <= 5; $i++) {
          if ($form->elementExists('email[' . $i . '][signature_text]')) {
            $form->removeElement('email[' . $i . '][signature_text]');
          }
        }
  
        // Remove field signature html
        for ($i = 0; $i <= 5; $i++) {
          if ($form->elementExists('email[' . $i . '][signature_html]')) {
            $form->removeElement('email[' . $i . '][signature_html]');
          }
        }
  
        // Remove field external id
        if ($form->elementExists('external_identifier')) {
          $form->removeElement('external_identifier');
        }
  
        // Remove field nickname
        if ($form->elementExists('nick_name')) {
          $form->removeElement('nick_name');
        }
  
        if ($form->getAction() == CRM_Core_Action::ADD) {
          // we can get the contact type from the url ct parameter: Individual/household/organisation
          $contactType = CRM_Utils_Array::value('ct', $_GET, '0');
        }
  
        elseif ($form->getAction() == CRM_Core_Action::UPDATE) {
          // there is no info in the url so we need to use the contact id and check
          $contactId = CRM_Utils_Array::value('cid', $_GET, '0');
          if ($contactId != 0) {
            $contactType = CRM_Contact_BAO_Contact::getContactType($contactId);
            // $subType = CRM_Contact_BAO_Contact::getContactSubType($contactId);
          }
        }
  
        // Household
        if ($contactType == 'Household') {
          // Remove custom block
          unset($form->_groupTree[3]);
          // Remove custom block
          unset($form->_groupTree[7]);
          // Change label of household name
          if ($form->elementExists('household_name')) {
            $element = &$form->getElement('household_name');
            $element->setLabel('NEW LABEL');
          }
        }
        elseif ($contactType == 'Organization') {
          // Remove custom block
          unset($form->_groupTree[1]);
          // Remove custom block
          unset($form->_groupTree[7]);
          if ($form->elementExists('sic_code')) {
            $form->removeElement('sic_code');
          }
        }
        else {
          // Individual
        }
      }
    }
  }
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks. Unfortunately I'm afraid that this is too much afford if we take the frontend migration plans of civicrm into account.  
  > **username_4**: I'm not sure what you mean with "too much effort". First: this code does a lot more than just remove a simple "nickname" field. Second: the effort of writing code becomes very little once you know how to do it and I think this is a nice example how to do it in a way that targets in a futureproof way the right fields without creating issues with future upgrades of civi.  
  > **username_0**: I'm sorry, I did not want to question your approach in general. It's just I'm not trusting this old form builder stuff to be future proof.  
  
  ---
  
  ### Answer by username_5 on 2021-03-04. Score: 1
  
  Building on [username_4](https://civicrm.stackexchange.com/a/37689/)'s helpful answer, below are paired PHP and javascript to remove some contact fields when adding or editing contacts.
  
  Note there is a WordPress-specific function call to obtain the path to the javascript file, which I assume is stored in the `.../plugins/CUSTOMPLUGIN/assets/` folder, with a `define('WP_CUSTOMPLUGIN_FILE', __FILE__);` directive in the main plugin PHP file.
  
  **PHP hook**
  
  ```
  
  /**
   * Implements hook_civicrm_buildForm().
   *
   * Changes some fields on the add and update contact forms
   *
   * @param string $formName
   * @param CRM_Core_Form $form
   */
  function MODULE_civicrm_buildForm($formName, &$form) {
      if ($formName !== 'CRM_Contact_Form_Contact') {
          return;
      }
      if (($form->getAction() !== CRM_Core_Action::ADD) && ($form->getAction() !== CRM_Core_Action::UPDATE)) {
          return;
      }
      // ***WORDPRESS-SPECIFIC: javascript for contacts edit page
      $jsUrl = plugins_url('assets/cv_editcntct.js', WP_CUSTOMPLUGIN_FILE);
      CRM_Core_Resources::singleton()->addScriptUrl($jsUrl);
  
      // Remove some address fields
      for ($i = 0; $i <= 5; $i++) {
          // geocoding
          if ($form->elementExists('address[' . $i . '][geo_code_1]')) {
              $form->removeElement('address[' . $i . '][geo_code_1]');
              $form->removeElement('address[' . $i . '][geo_code_2]');
          }
  
          // county
          if ($form->elementExists('address[' . $i . '][county_id]')) {
              $form->removeElement('address[' . $i . '][county_id]');
          }
      }
  
      // See also cv_editcntct.js
      for ($i = 0; $i <= 5; $i++) {
          // Remove field signature text
          if ($form->elementExists('email[' . $i . '][signature_text]')) {
                  $form->removeElement('email[' . $i . '][signature_text]');
          }
          // Remove field signature html
          if ($form->elementExists('email[' . $i . '][signature_html]')) {
                  $form->removeElement('email[' . $i . '][signature_html]');
          }
      }
  
      if ($form->elementExists('employer_id')) {
          $form->removeElement('employer_id');
      }
      if ($form->elementExists('job_title')) {
          $form->removeElement('job_title');
      }
      if ($form->elementExists('image_URL')) {
          $form->removeElement('image_URL');
      }
  
      $contactType = NULL;
      if ($form->getAction() == CRM_Core_Action::ADD) {
          // we can get the contact type from the url ct parameter: Individual/household/organisation
          $contactType = CRM_Utils_Array::value('ct', $_GET, '0');
      }
      elseif ($form->getAction() == CRM_Core_Action::UPDATE) {
          // there is no info in the url so we need to use the contact id and check
          $contactId = CRM_Utils_Array::value('cid', $_GET, '0');
          if ($contactId != 0) {
              $contactType = CRM_Contact_BAO_Contact::getContactType($contactId);
              //$subType = CRM_Contact_BAO_Contact::getContactSubType($contactId);
          }
      }
  
      // Adjustments specific to contact type...
      if ($contactType == 'Household') {
          // no Household customizations
      }
      elseif ($contactType == 'Organization') {
          // // Remove custom block
          // unset($form->_groupTree[1]);
          if ($form->elementExists('sic_code')) {
              $form->removeElement('sic_code');
          }
      }
      else {
          // Individual
          // // Remove field nickname
          // if ($form->elementExists('nick_name')) {
          //  $form->removeElement('nick_name');
          // }
      }
  }
  
  ```
  
  **Javascript** `cv_editcntct.js` **file**
  
  ```
  (function($, undefined){
      //console.log('hello from cv_editcntct.js');
  
      // for individual: employer and job title has been removed
      // adjust layout with or without nickname
      var $st = $('#contact_sub_type');
      var $nn = $st.closest('tr').find('#nick_name');
      if ($nn.length) {
          // remove all (empty) TD cells prior to nickname and adjust width
          var $td = $nn.closest('td').attr('colspan','2');
          $td.prevAll().remove();
          $nn.css('width',$td.width()+'px');
          // also adjust subtype width
          $td = $st.closest('td').attr('colspan','3');
          $st.css('width',$td.width()+'px');
      } else {
          // remove empty TD cells before subtype, and adjust subtype width
          var $td = $st.closest('td').attr('colspan','3');
          $td.prevAll().remove();
          $st.css('width',$td.width()+'px');
      }
      
      // remove (empty) image URL section (table)
      $('table.image_URL-section').remove();
  
      // remove (empty) signature blocks
      $('.email-signature.crm-collapsible').remove();
      // since new emails can be added, monitor the DOM for added elements 
      // and remove signature blocks
      $emailSection = $('.crm-section.contact_information-section');
      if ($emailSection.length) {
          // Callback function to execute when mutations are observed
          const callback = function(mutationsList, observer) {
              // Use traditional 'for loops' for IE 11
              var bAdded = false;
              for (const mutation of mutationsList) {
                  if (mutation.addedNodes.length) {
                      bAdded = true;
                      break;
                  }
              }
              if (bAdded) {
                  // remove (empty) signature blocks
                  var $s = $('.email-signature.crm-collapsible');
                  if ($s.length) {
                      $s.remove();
                      console.log("Zapped a signature block!");
                  }
              }
          };
          // Create a DOM observer
          const observer = new MutationObserver(callback);
          // Start watching for element additions (or removals) in the email section
          observer.observe($emailSection.get(0), { childList: true, subtree: true }); 
      }
  
  })(jQuery);
  
  ```
  
  
  ---
  
  