From f30a8dfb2d94acf086b003f033ccd3a2fbb8d063 Mon Sep 17 00:00:00 2001 From: Tim Mallezie Date: Wed, 29 Apr 2015 18:10:48 +0200 Subject: [PATCH] use addField in CRM_Contact_Form_GroupContact CRM-16178 --- CRM/Contact/Form/GroupContact.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/CRM/Contact/Form/GroupContact.php b/CRM/Contact/Form/GroupContact.php index 052569046b..869a3e1f46 100644 --- a/CRM/Contact/Form/GroupContact.php +++ b/CRM/Contact/Form/GroupContact.php @@ -53,6 +53,20 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form { */ protected $_contactId; + /** + * Explicitly declare the entity api name. + */ + public function getDefaultEntity() { + return 'GroupContact'; + } + + /** + * Explicitly declare the form context. + */ + public function getDefaultContext() { + return 'create'; + } + public function preProcess() { $this->_contactId = $this->get('contactId'); $this->_groupContactId = $this->get('groupContactId'); @@ -101,10 +115,7 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form { $msg = ts('Add to a group'); } - $this->add('select', 'group_id', '', $groupSelect, TRUE, array( - 'class' => 'crm-select2 crm-action-menu action-icon-plus', - 'placeholder' => $msg, - )); + $this->addField('group_id', array('class' => 'crm-action-menu action-icon-plus', 'placeholder' => $msg, 'options' => $groupSelect)); $this->addButtons(array( array( -- 2.25.1