3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components for custom data
21 * It delegates the work to lower level subclasses and integrates the changes
22 * back in. It also uses a lot of functionality with the CRM API's, so any change
23 * made here could potentially affect the API etc. Be careful, be aware, use unit tests.
26 class CRM_Profile_Form_Dynamic
extends CRM_Profile_Form
{
29 * Pre processing work done here.
34 public function preProcess() {
35 if ($this->get('register')) {
36 $this->_mode
= CRM_Profile_Form
::MODE_REGISTER
;
39 $this->_mode
= CRM_Profile_Form
::MODE_EDIT
;
42 if ($this->get('skipPermission')) {
43 $this->_skipPermission
= TRUE;
46 // also allow dupes to be updated for edit in my account (CRM-2232)
47 $this->_isUpdateDupe
= TRUE;
53 * Build the form object.
56 public function buildQuickForm() {
65 // also add a hidden element for to trick drupal
66 $this->addElement('hidden', "edit[civicrm_dummy_field]", "CiviCRM Dummy Field for Drupal");
67 parent
::buildQuickForm();
69 $this->addFormRule(['CRM_Profile_Form_Dynamic', 'formRule'], $this);
75 * @param array $fields
76 * The input form values.
78 * The uploaded files if any.
79 * @param CRM_Core_Form $form
83 * true if no errors, else array of errors
85 public static function formRule($fields, $files, $form) {
88 // if no values, return
89 if (empty($fields) ||
empty($fields['edit'])) {
93 return CRM_Profile_Form
::formRule($fields, $files, $form);
97 * Process the user submitted custom data values.
99 public function postProcess() {
100 parent
::postProcess();