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

Allow to override preprocess function in class which extends CRM_Event_Form_ManageEvent_Location

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.5.8
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Documentation Required?:
      None

      Description

      When i create a class which extends CRM_Event_Form_ManageEvent_Location and try to extend the preprocess function, i run into the message _blocks not defined.

      To be clear i'm trying to implement following function
      class CRM_Event_Form_ManageCursus_Location extends CRM_Event_Form_ManageEvent_Location {
      function preProcess()

      { parent::preProcess(); // Implement custom code }

      }

      The reason this fails is inside the preprocess function of CRM_Event_Form_ManageEvent_Location, this calls a static preprocess function on CRM_Contact_Form_Location. In this function the following is defined.

      if (in_array($className, array(
      'CRM_Event_Form_ManageEvent_Location', 'CRM_Contact_Form_Domain')))

      { $form->_blocks = array('Address' => ts('Address'), 'Email' => ts('Email'), 'Phone' => ts('Phone'), ); }

      Which hardcodes this to those two classes. A better fix would be to make this available for all classes, but i think it's most simple to start to allow this for subclasses. I'll create a PR.

        Attachments

          Activity

            People

            • Assignee:
              colemanw Coleman Watts
              Reporter:
              mallezie Tim Mallezie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: