From: Tim Mallezie Date: Tue, 10 Mar 2015 20:52:50 +0000 (+0100) Subject: initial code for CRM-16089 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=512514bbc79cea2e30dfcd07fa647f43abb9c8a6;p=civicrm-core.git initial code for CRM-16089 --- diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 3b70af47c6..5add53d7b4 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -125,6 +125,13 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @var CRM_Core_Controller */ public $controller; + + /** + * Api entity name + * + * @var string + */ + public $entityName; /** * Constants for attributes for various form elements @@ -1051,7 +1058,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page { */ public function addSelect($name, $props = array(), $required = FALSE) { if (!isset($props['entity'])) { - $props['entity'] = CRM_Utils_Api::getEntityName($this); + if(isset($this->entityName)){ + $props['entity'] = $this->entityName; + } + else { + $props['entity'] = CRM_Utils_Api::getEntityName($this); + } } if (!isset($props['field'])) { $props['field'] = strrpos($name, '[') ? rtrim(substr($name, 1 + strrpos($name, '[')), ']') : $name; diff --git a/CRM/Event/Form/ManageEvent/EventInfo.php b/CRM/Event/Form/ManageEvent/EventInfo.php index 89d27e4504..bdb10a2cb4 100644 --- a/CRM/Event/Form/ManageEvent/EventInfo.php +++ b/CRM/Event/Form/ManageEvent/EventInfo.php @@ -187,6 +187,8 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { // add event title, make required if this is not a template $this->add('text', 'title', ts('Event Title'), $attributes['event_title'], !$this->_isTemplate); + // We must specify the entity api name when using an addSelect + $this->entityName = 'Event'; $this->addSelect('event_type_id', array('onChange' => "CRM.buildCustomData( 'Event', this.value );"), TRUE