From d2939e20170af47719d2fda9bcc25573fbc40ad8 Mon Sep 17 00:00:00 2001 From: Aidan Saunders <aidan.saunders@gmail.com> Date: Tue, 16 Jan 2018 11:16:37 +0000 Subject: [PATCH] Update hook_civicrm_buildForm.md Minor formatting issues, remove stray backslashes --- docs/hooks/hook_civicrm_buildForm.md | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/docs/hooks/hook_civicrm_buildForm.md b/docs/hooks/hook_civicrm_buildForm.md index c610b61b..c6cbc19e 100644 --- a/docs/hooks/hook_civicrm_buildForm.md +++ b/docs/hooks/hook_civicrm_buildForm.md @@ -36,10 +36,6 @@ elements attributes, and to add new fields to a form. } } - - - - !!! tip To access useful values in your hook_civicrm_buildForm function, consider the following: @@ -48,8 +44,6 @@ elements attributes, and to add new fields to a form. $form->getVar( '_gid' ); $form->setVar( '_gid', VALUE ); // sets the variable - -\ Change a price set field to be required for a specific event. function example_civicrm_buildForm($formName, &$form) { @@ -62,17 +56,18 @@ elements attributes, and to add new fields to a form. !!! tip With the QuickForms system that CiviCRM uses, you need to do two things to make fields appear: - 1. You need to create the element in the form, which is what you can do in the buildForm() hook,\ - 2. You need to modify the Smarty template used to display the form so it contains the generated HTML for the new form element. + + 1. You need to create the element in the form, which is what you can do in the buildForm() hook, + 2. You need to modify the Smarty template used to display the form so it contains the generated HTML for the new form element. The later can be achieved by: - overriding the core CiviCRM template with a new one (either in the custom templates directory, or within the templates directory of an extension), - - or dynamically inserting a template part in the page through the Regions API.\ + - or dynamically inserting a template part in the page through the Regions API. This is demonstrated in the next example. - NOTE: the Regions API is only available if the template contains Regions in the first place - this is not the case with the Inline edit forms! You will then need to either add fake form elements, or modify existing elements' attributes to reach your goals.\ + NOTE: the Regions API is only available if the template contains Regions in the first place - this is not the case with the Inline edit forms! You will then need to either add fake form elements, or modify existing elements' attributes to reach your goals. @@ -101,4 +96,4 @@ elements attributes, and to add new fields to a form. {* reposition the above block after #someOtherBlock *} <script type="text/javascript"> cj('#testfield-tr').insertAfter('#someOtherBlock') - </script> \ No newline at end of file + </script> -- GitLab