From 7399a0a635e671e4d23161c2d2e150d09eef134f Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 11 Oct 2018 15:47:58 +0100 Subject: [PATCH] Convert a couple more settings fields. These are the 2 textarea fields at the end of the display form - sort format & display format. The text boxes are too small on page load - but this is unchanged IMHO --- CRM/Admin/Form/Preferences/Display.php | 19 ++----------------- CRM/Admin/Form/SettingTrait.php | 1 + settings/Core.setting.php | 10 ++++------ .../CRM/Admin/Form/Preferences/Display.tpl | 4 ++-- 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/CRM/Admin/Form/Preferences/Display.php b/CRM/Admin/Form/Preferences/Display.php index e67401d1f1..1db1863153 100644 --- a/CRM/Admin/Form/Preferences/Display.php +++ b/CRM/Admin/Form/Preferences/Display.php @@ -41,6 +41,8 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { 'contact_smart_group_display' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'advanced_search_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'preserve_activity_tab_filter' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'display_name_format' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'sort_name_format' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, ); public function preProcess() { @@ -74,16 +76,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { 'title' => ts('Contact Dashboard'), 'weight' => 9, ), - 'display_name_format' => array( - 'html_type' => 'textarea', - 'title' => ts('Individual Display Name Format'), - 'weight' => 10, - ), - 'sort_name_format' => array( - 'html_type' => 'textarea', - 'title' => ts('Individual Sort Name Format'), - 'weight' => 11, - ), 'editor_id' => array( 'html_type' => NULL, 'weight' => 12, @@ -113,13 +105,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { $defaults = parent::setDefaultValues(); parent::cbsDefaultValues($defaults); - if ($this->_config->display_name_format) { - $defaults['display_name_format'] = $this->_config->display_name_format; - } - if ($this->_config->sort_name_format) { - $defaults['sort_name_format'] = $this->_config->sort_name_format; - } - return $defaults; } diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index 92e961591f..827b44c56c 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -210,6 +210,7 @@ trait CRM_Admin_Form_SettingTrait { 'checkbox' => 'CheckBox', 'radio' => 'Radio', 'select' => 'Select', + 'textarea' => 'Element', ]; return $mapping[$spec['html_type']]; } diff --git a/settings/Core.setting.php b/settings/Core.setting.php index 0e19719b0c..4232a42662 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -158,28 +158,26 @@ return array( 'group' => 'core', 'name' => 'display_name_format', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'textarea', 'default' => '{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}', 'add' => '4.1', 'title' => ts('Individual Display Name Format'), 'is_domain' => 1, 'is_contact' => 0, - 'description' => NULL, - 'help_text' => NULL, + 'description' => ts('Display name format for individual contact display names.'), ), 'sort_name_format' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'sort_name_format', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'textarea', 'default' => '{contact.last_name}{, }{contact.first_name}', 'add' => '4.1', 'title' => ts('Individual Sort Name Format'), 'is_domain' => 1, 'is_contact' => 0, - 'description' => NULL, - 'help_text' => NULL, + 'description' => ts('Sort name format for individual contact display names.'), ), 'remote_profile_submissions' => array( 'group_name' => 'CiviCRM Preferences', diff --git a/templates/CRM/Admin/Form/Preferences/Display.tpl b/templates/CRM/Admin/Form/Preferences/Display.tpl index 8a89f8b626..5ffc84caef 100644 --- a/templates/CRM/Admin/Form/Preferences/Display.tpl +++ b/templates/CRM/Admin/Form/Preferences/Display.tpl @@ -199,7 +199,7 @@   - {ts}Display name format for individual contact display names.{/ts} + {$settings_fields.display_name_format.description} {$form.sort_name_format.label} @@ -207,7 +207,7 @@   - {ts}Sort name format for individual contact display names.{/ts} + {$settings_fields.sort_name_format.description}
{include file="CRM/common/formButtons.tpl" location="bottom"}
-- 2.25.1