From 4a44fd8a9b38da8ea7d4e593d87b762d32b5b1da Mon Sep 17 00:00:00 2001 From: Tim Mallezie Date: Wed, 11 Mar 2015 10:26:50 +0100 Subject: [PATCH] code style and declare entity in parent class definition. --- CRM/Core/Form.php | 8 ++++---- CRM/Event/Form/ManageEvent.php | 5 +++++ CRM/Event/Form/ManageEvent/EventInfo.php | 2 -- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 5add53d7b4..15810e6c0f 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -125,10 +125,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @var CRM_Core_Controller */ public $controller; - + /** * Api entity name - * + * * @var string */ public $entityName; @@ -1058,7 +1058,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { */ public function addSelect($name, $props = array(), $required = FALSE) { if (!isset($props['entity'])) { - if(isset($this->entityName)){ + if (isset($this->entityName)) { $props['entity'] = $this->entityName; } else { @@ -1859,7 +1859,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { if (!$options) { $targetField->setAttribute('placeholder', $targetField->getAttribute('data-none-prompt')); } - } + } else { $targetField->setAttribute('placeholder', $targetField->getAttribute('data-empty-prompt')); $targetField->setAttribute('disabled', 'disabled'); diff --git a/CRM/Event/Form/ManageEvent.php b/CRM/Event/Form/ManageEvent.php index ae92d3a363..6e4f11ff6a 100644 --- a/CRM/Event/Form/ManageEvent.php +++ b/CRM/Event/Form/ManageEvent.php @@ -86,6 +86,11 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { * Check if repeating event. */ public $_isRepeatingEvent; + + /** + * Explicitly declare the entity api name. + */ + public $entityName = 'Event'; /** * Set variables up before form is built. diff --git a/CRM/Event/Form/ManageEvent/EventInfo.php b/CRM/Event/Form/ManageEvent/EventInfo.php index bdb10a2cb4..89d27e4504 100644 --- a/CRM/Event/Form/ManageEvent/EventInfo.php +++ b/CRM/Event/Form/ManageEvent/EventInfo.php @@ -187,8 +187,6 @@ 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 -- 2.25.1