add textarea, and convert note
authorTim Mallezie <tim.mallezie@chiro.be>
Sat, 28 Mar 2015 21:19:43 +0000 (22:19 +0100)
committerTim Mallezie <tim.mallezie@chiro.be>
Tue, 14 Apr 2015 14:38:10 +0000 (16:38 +0200)
CRM/Contact/Form/Edit/Notes.php
CRM/Contact/Form/Relationship.php
CRM/Core/Form.php

index 68495ac94e65786af0950dbd2008c602cac43d3c..dce7363a430855573269e7f194d14dc3725f3bb1 100644 (file)
@@ -42,8 +42,7 @@ class CRM_Contact_Form_Edit_Notes {
    */
   public static function buildQuickForm(&$form) {
     $form->applyFilter('__ALL__', 'trim');
-    $form->add('text', 'subject', ts('Subject'), array('size' => 60, 'maxlength' => 254));
-    $form->add('textarea', 'note', ts('Notes'), array('cols' => '60', 'rows' => '3'));
+    $form->addField('note', array('entity' => 'note', 'cols' => '60', 'rows' => '3'));
   }
 
 }
index 09be61828425de51a4a5fade493650e23c08896d..cb99e724452eca2fad9ad8477112eccf73666b76 100644 (file)
@@ -108,6 +108,20 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
    */
   public $_cdType;
 
+  /**
+   * Explicitly declare the form context.
+   */
+  public function getDefaultContext() {
+    return 'create';
+  }
+
+  /**
+   * Explicitly declare the entity api name.
+   */
+  public function getDefaultEntity() {
+    return 'Relationship';
+  }
+
   public function preProcess() {
     //custom data related code
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
index c6079b34c4688d79b53c405c892274309f4ca4bd..d6a01204125ecb2e3bc5670121e16cf05559ff2f 100644 (file)
@@ -1250,7 +1250,13 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         $this->add('hidden', $name, $label, $props, $required);
         break;
 
-      //case 'TextArea':
+      case 'TextArea':
+        //Set default columns and rows for textarea.
+        $props['rows'] = isset($props['rows']) ? $props['rows'] : 4;
+        $props['cols'] = isset($props['cols']) ? $props['cols'] : 60;
+        $this->addElement('textarea', $name, $label, $props, $required);
+        break;
+
       //case 'Select Date':
       //TODO: Add date formats
       //TODO: Add javascript template for dates.