From 2b59da4a9109f40ca0ae1b2ed61f9df1b80a63f7 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Tue, 5 Feb 2019 16:14:33 +0000 Subject: [PATCH] Use addField to generated form fields on Note form --- CRM/Note/Form/Note.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/CRM/Note/Form/Note.php b/CRM/Note/Form/Note.php index 49da0e33e4..e2d65e1c10 100644 --- a/CRM/Note/Form/Note.php +++ b/CRM/Note/Form/Note.php @@ -112,6 +112,20 @@ class CRM_Note_Form_Note extends CRM_Core_Form { return $defaults; } + /** + * Explicitly declare the entity api name. + */ + public function getDefaultEntity() { + return 'Note'; + } + + /** + * Explicitly declare the form context. + */ + public function getDefaultContext() { + return 'create'; + } + /** * Build the form object. * @@ -134,10 +148,9 @@ class CRM_Note_Form_Note extends CRM_Core_Form { return; } - $this->add('text', 'subject', ts('Subject:'), array('size' => 20)); - $this->add('textarea', 'note', ts('Note:'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note', 'note'), TRUE); - $this->add('select', 'privacy', ts('Privacy:'), CRM_Core_OptionGroup::values('note_privacy')); - + $this->addField('subject'); + $this->addField('note', [], TRUE); + $this->addField('privacy'); $this->add('hidden', 'parent_id'); // add attachments part -- 2.25.1