From 0efbca6868678da5cc686f9147398ce34ade449d Mon Sep 17 00:00:00 2001 From: Tim Mallezie Date: Sat, 28 Mar 2015 22:19:43 +0100 Subject: [PATCH] add textarea, and convert note --- CRM/Contact/Form/Edit/Notes.php | 3 +-- CRM/Contact/Form/Relationship.php | 14 ++++++++++++++ CRM/Core/Form.php | 8 +++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CRM/Contact/Form/Edit/Notes.php b/CRM/Contact/Form/Edit/Notes.php index 68495ac94e..dce7363a43 100644 --- a/CRM/Contact/Form/Edit/Notes.php +++ b/CRM/Contact/Form/Edit/Notes.php @@ -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')); } } diff --git a/CRM/Contact/Form/Relationship.php b/CRM/Contact/Form/Relationship.php index 09be618284..cb99e72445 100644 --- a/CRM/Contact/Form/Relationship.php +++ b/CRM/Contact/Form/Relationship.php @@ -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); diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index c6079b34c4..d6a0120412 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -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. -- 2.25.1