Answers.Body: <p>There are a number of strategies for customizing CiviCRM!  They have their advantages and disadvantages - but you should definitely be concerned about your change disappearing on upgrade.</p>
  
  <p>The easiest change is to use a custom PHP page just like a custom template.  Details are available on this <a href="https://civicrm.stackexchange.com/questions/11547/how-to-add-custom-templates-tpls-or-php-files">wiki page</a>.  However, this is rarely a maintainable solution, because you'll need to compare your file to the original every time you upgrade and move your changes over.</p>
  
  <p>A better solution is to <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Create+an+Extension" rel="nofollow noreferrer">create an extension</a> and use a hook.  The correct hook here is <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm" rel="nofollow noreferrer">hook_civicrm_buildForm</a>.  I would insert a simple conditional to check that the <code>$formName</code> is the one you want to operate on, and if so to add your one line of code.  This is far more maintainable.  </p>
  
  <p>Please join us at <a href="http://chat.civicrm.org" rel="nofollow noreferrer">http://chat.civicrm.org</a> in the #dev-newcomers channel and we'll be happy to help get you set up with civix or any other tools you need to create extensions!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-01T12:35:41.087Z
Answers.Text: Thank's, I used custom php. Create an extension is challenge. Maybe next time...
Answers.UserDisplayName: mekke
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-29T19:56:51.693Z
Answers.LastActivityDate: 2016-11-29T19:56:51.693Z
Answers.LastEditDate: 2017-04-13T12:53:13.017Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Why not simply a civicrm custom field, that you could use in a Profile or a Webform (if you are based upon Drupal) ?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-30T16:41:58.613Z
Answers.LastActivityDate: 2016-11-30T16:41:58.613Z
Answers.UserDisplayName: Jacques-Marie Moranne
Body: <p>I tried add legal_identifier field by custom tempelate. It worked for pages, but not for forms.
  Then I added this code to sites/all/modules/civicrm/CRM/Contact/Form/Edit/Organization.php:</p>
  
  <pre><code>$form-&gt;addField('legal_identifier');
  </code></pre>
  
  <p>Now it works good in organization contacts, but I'm not shure if this is correct. Can I edit this file? What will happen after update?
  Is there some better way? Can I use some hook? How?
  Thank's, I'm getting started with civiCRM.</p>
  
Tags: <forms><fields>
Title: Add legal_identifier field to contact page and form?
ThreadText: # Add legal_identifier field to contact page and form?
  
  (Asked by: username_0 on 2016-11-29)
  
  I tried add legal_identifier field by custom tempelate. It worked for pages, but not for forms.
  Then I added this code to sites/all/modules/civicrm/CRM/Contact/Form/Edit/Organization.php:
  $form->addField('legal_identifier');
  
  Now it works good in organization contacts, but I'm not shure if this is correct. Can I edit this file? What will happen after update?
  Is there some better way? Can I use some hook? How?
  Thank's, I'm getting started with civiCRM.
  
  **Tags:** forms, fields
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-11-29. Score: 0 | Accepted answer
  
  There are a number of strategies for customizing CiviCRM! They have their advantages and disadvantages - but you should definitely be concerned about your change disappearing on upgrade.
  
  The easiest change is to use a custom PHP page just like a custom template. Details are available on this [wiki page](https://civicrm.stackexchange.com/questions/11547/how-to-add-custom-templates-tpls-or-php-files). However, this is rarely a maintainable solution, because you'll need to compare your file to the original every time you upgrade and move your changes over.
  
  A better solution is to [create an extension](https://wiki.civicrm.org/confluence/display/CRMDOC/Create+an+Extension) and use a hook. The correct hook here is [hook\_civicrm\_buildForm](https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm). I would insert a simple conditional to check that the `$formName` is the one you want to operate on, and if so to add your one line of code. This is far more maintainable.
  
  Please join us at <http://chat.civicrm.org> in the #dev-newcomers channel and we'll be happy to help get you set up with civix or any other tools you need to create extensions!
  
  > **Comments:**
  > **username_0**: Thank's, I used custom php. Create an extension is challenge. Maybe next time...  
  
  ---
  
  ### Answer by username_2 on 2016-11-30. Score: 1
  
  Why not simply a civicrm custom field, that you could use in a Profile or a Webform (if you are based upon Drupal) ?
  
  
  ---
  
  