Body: <p><strong>Preamble:</strong> </p>
  
  <p>Event Registration Settings form ( civicrm/event/manage/settings?reset=1&amp;action=update&amp;id=EVENT-ID ) has separated text areas for <strong>Event Summary/Description</strong> ( "Info and Settings" tab) and <strong>Introductory Text</strong> ( Online Registration tab ). </p>
  
  <p>We'd like to use both  at Online Registration Form (civicrm/event/register?id=EVENT-ID&amp;reset=1) or only <strong>Event Summary/Description</strong>  in order to eliminate same text copy&amp;paste twice for both "description" fields. </p>
  
  <p>Assuming one of civicrm hooks in a custom Drupal module  can be used, just more convenient than custom template creation  </p>
  
  <p><strong>Code</strong></p>
  
  <p>Something like this </p>
  
  <pre><code>if($formName == 'CRM_Event_Form_Registration_Register') {
    $form-&gt;_values['event']['intro_text'] =  $form-&gt;_values['event']['description'];
  }
  </code></pre>
  
  <p><strong>Problem</strong></p>
  
  <p>There are hooks which, according to descriptions, must execute the below code but somehow it doesn't work:</p>
  
  <ul>
  <li><em>hook_civicrm_preProcess</em></li>
  <li><em>hook__civicrm_buildForm</em></li>
  </ul>
  
  <p>There are also hook_civicrm_alterContent (which can do str_replace inside given text) and hook_civicrm_alterTemplateFile (which can help in TPL file substitution somehow), yet both aren't suitable for the situation.    </p>
  
  <p><strong>Question</strong> </p>
  
  <p>Any chance hook_civicrm_preProcess/hook__civicrm_buildForm can be used or custom copy of civicrm\templates\CRM\Event\Form\Registration\Register.tpl alter is the only option here?</p>
  
  <p>Thanks!</p>
  
  <p>P.S. There are some related discussions regarding these hooks here; 
  unfortunately solutions proposed do not work somehow.    </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-14T05:19:05.577Z
Comments.Text: Have you tried pageRun hook - https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_pageRun/?
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-14T20:19:58.403Z
Comments.Text: I've been under impression Event Registration is a form, so was looking for Form hooks; besides, pageRun hook description states, that "This does not execute on every CiviCRM page in the general sense. CiviCRM's pages are classified as either 'Forms' or 'Pages', and this only runs on pages classified as 'Pages'." What do you think?
Comments.UserDisplayName: yurg
Tags: <civievent><drupal><hooks><templates>
Title: Which civicrm hook for Event Registration form field content change in Drupal module?
ThreadText: # Which civicrm hook for Event Registration form field content change in Drupal module?
  
  (Asked by: username_0 on 2017-10-13)
  
  Preamble: 
  Event Registration Settings form ( civicrm/event/manage/settings?reset=1&action=update&id=EVENT-ID ) has separated text areas for Event Summary/Description ( "Info and Settings" tab) and Introductory Text ( Online Registration tab ). 
  We'd like to use both  at Online Registration Form (civicrm/event/register?id=EVENT-ID&reset=1) or only Event Summary/Description  in order to eliminate same text copy&paste twice for both "description" fields. 
  Assuming one of civicrm hooks in a custom Drupal module  can be used, just more convenient than custom template creation  
  Code
  Something like this 
  if($formName == 'CRM_Event_Form_Registration_Register') {
    $form->_values['event']['intro_text'] =  $form->_values['event']['description'];
  }
  
  Problem
  There are hooks which, according to descriptions, must execute the below code but somehow it doesn't work:
  
  hook_civicrm_preProcess
  hook__civicrm_buildForm
  
  There are also hook_civicrm_alterContent (which can do str_replace inside given text) and hook_civicrm_alterTemplateFile (which can help in TPL file substitution somehow), yet both aren't suitable for the situation.    
  Question 
  Any chance hook_civicrm_preProcess/hook__civicrm_buildForm can be used or custom copy of civicrm\templates\CRM\Event\Form\Registration\Register.tpl alter is the only option here?
  Thanks!
  P.S. There are some related discussions regarding these hooks here; 
  unfortunately solutions proposed do not work somehow.
  
  **Tags:** civievent, drupal, hooks, templates
  
  > **Comments:**
  > **username_1**: Have you tried pageRun hook - https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_pageRun/?  
  > **username_0**: I've been under impression Event Registration is a form, so was looking for Form hooks; besides, pageRun hook description states, that "This does not execute on every CiviCRM page in the general sense. CiviCRM's pages are classified as either 'Forms' or 'Pages', and this only runs on pages classified as 'Pages'." What do you think?  
  
  ---
  
  ## 0 answers
  
  