Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-20351

hook_civicrm_buildForm invoked twice on a bunch of forms

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      Yes

      Description

      Within the CRM_ACL_Page_ACL class, the run() method calls the edit() method when the action is add, update, or delete. It then called the parent (CRM_Core_Page_Basic) run() method which also calls the edit() method. The result is that the form is built twice. The biggest problem here is that it means hook_civicrm_buildForm and other hooks are invoked twice.

      After writing a test for this, it turns out that a total of 10 forms do this.

      Note: this is distinct from the situation on some forms where hook_civicrm_buildForm is invoked twice, once for the entity custom fields form and once for the entity form itself. That is normal behavior, and the formName passed to the hook is different each time in that case.

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              andrewhunt Andrew Hunt
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: