From: Tim Mallezie Date: Thu, 26 Mar 2015 20:25:55 +0000 (+0100) Subject: add hidden support to addField, convert Edit_Lock and Inline_Lock X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b4b53245fbff3a8767ac8c78f3e2547b118ecf59;p=civicrm-core.git add hidden support to addField, convert Edit_Lock and Inline_Lock --- diff --git a/CRM/Contact/Form/Edit/Lock.php b/CRM/Contact/Form/Edit/Lock.php index 476b1e0b6b..7663c3aec4 100644 --- a/CRM/Contact/Form/Edit/Lock.php +++ b/CRM/Contact/Form/Edit/Lock.php @@ -48,7 +48,7 @@ class CRM_Contact_Form_Edit_Lock { * @return void */ public static function buildQuickForm(&$form) { - $form->addElement('hidden', 'modified_date', '', array('id' => 'modified_date')); + $form->addField('modified_date', array('type' => 'hidden', 'id' => 'modified_date', 'label' => '')); } /** diff --git a/CRM/Contact/Form/Inline.php b/CRM/Contact/Form/Inline.php index 1241396a8a..fa6d559941 100644 --- a/CRM/Contact/Form/Inline.php +++ b/CRM/Contact/Form/Inline.php @@ -53,6 +53,20 @@ abstract class CRM_Contact_Form_Inline extends CRM_Core_Form { */ public $_contactSubType; + /** + * Explicitly declare the form context. + */ + public function getDefaultContext() { + return 'create'; + } + + /** + * Explicitly declare the entity api name. + */ + public function getDefaultEntity() { + return 'Contact'; + } + /** * Common preprocess: fetch contact ID and contact type */ diff --git a/CRM/Contact/Form/Inline/Lock.php b/CRM/Contact/Form/Inline/Lock.php index b963f823d0..8450ea08a3 100644 --- a/CRM/Contact/Form/Inline/Lock.php +++ b/CRM/Contact/Form/Inline/Lock.php @@ -58,7 +58,7 @@ class CRM_Contact_Form_Inline_Lock { // - V1:open E1:open E1:submit V1.email:open V1.email:submit // - V1:open V1.email:open E1:open E1:submit V1.email:submit V1:lock $timestamps = CRM_Contact_BAO_Contact::getTimestamps($contactID); - $form->addElement('hidden', 'oplock_ts', $timestamps['modified_date'], array('id' => 'oplock_ts')); + $form->addField('oplock_ts', array('type' => 'hidden', 'id' => 'oplock_ts', 'label' => $timestamps['modified_date'])); $form->addFormRule(array('CRM_Contact_Form_Inline_Lock', 'formRule'), $contactID); } diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 29ecb9b824..4b1018f3e5 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1222,6 +1222,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $this->addElement('text', $name, $label, $props, $required); break; + case 'hidden': + $this->addElement('hidden', $name, $label, $props); + break; + //case 'TextArea': //case 'Select Date': //TODO: Add date formats