* @var CRM_Core_Controller
*/
public $controller;
+
+ /**
+ * Api entity name
+ *
+ * @var string
+ */
+ public $entityName;
/**
* Constants for attributes for various form elements
*/
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;
// 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