Merge pull request #13187 from JMAConsulting/payment_function
[civicrm-core.git] / CRM / Note / Form / Note.php
index f66cd0fb3bb737459be880d503f35a8adda0dff7..e2d65e1c10f57d7501c671b328965692d1b3932f 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  * $Id$
  *
  */
@@ -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