From a7e1569230daebf06921922f9040b47228e3eea8 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 29 Oct 2018 19:23:10 +1300 Subject: [PATCH] Fix campaign preferences form --- CRM/Admin/Form/Preferences/Campaign.php | 29 +++++-------------------- CRM/Admin/Form/SettingTrait.php | 1 + settings/Campaign.setting.php | 21 +++++++++--------- 3 files changed, 16 insertions(+), 35 deletions(-) diff --git a/CRM/Admin/Form/Preferences/Campaign.php b/CRM/Admin/Form/Preferences/Campaign.php index 196a24a75e..38496affee 100644 --- a/CRM/Admin/Form/Preferences/Campaign.php +++ b/CRM/Admin/Form/Preferences/Campaign.php @@ -29,35 +29,16 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2018 - * $Id: Display.php 36505 2011-10-03 14:19:56Z lobo $ - * */ /** - * This class generates form components for the display preferences - * + * This class displays campaign preferences. */ class CRM_Admin_Form_Preferences_Campaign extends CRM_Admin_Form_Preferences { - public function preProcess() { - CRM_Utils_System::setTitle(ts('CiviCampaign Component Settings')); - $this->_varNames = array( - CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME => array( - 'tag_unconfirmed' => array( - 'html_type' => 'text', - 'title' => ts('Tag for Unconfirmed Petition Signers'), - 'weight' => 1, - 'description' => ts('If set, new contacts that are created when signing a petition are assigned a tag of this name.'), - ), - 'petition_contacts' => array( - 'html_type' => 'text', - 'title' => ts('Petition Signers Group'), - 'weight' => 2, - 'description' => ts('All contacts that have signed a CiviCampaign petition will be added to this group. The group will be created if it does not exist (it is required for email verification).'), - ), - ), - ); - parent::preProcess(); - } + protected $_settings = [ + 'tag_unconfirmed' => CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME, + 'petition_contacts' => CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME, + ]; } diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index 219291fa57..fafae4f4d6 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -229,6 +229,7 @@ trait CRM_Admin_Form_SettingTrait { 'radio' => 'Radio', 'select' => 'Select', 'textarea' => 'Element', + 'text' => 'Element', 'entity_reference' => 'EntityRef', ]; return $mapping[$spec['html_type']]; diff --git a/settings/Campaign.setting.php b/settings/Campaign.setting.php index e3d2ea4078..bbf3e08508 100644 --- a/settings/Campaign.setting.php +++ b/settings/Campaign.setting.php @@ -29,10 +29,9 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2017 - * $Id$ - * */ -/* + +/** * Settings metadata file */ @@ -42,28 +41,28 @@ return array( 'group' => 'campaign', 'name' => 'tag_unconfirmed', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'Unconfirmed', 'add' => '4.1', - 'title' => 'Tag for Unconfirmed Petition Signers', + 'title' => ts('Tag for Unconfirmed Petition Signers'), 'is_domain' => 1, 'is_contact' => 0, - 'description' => NULL, - 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + 'description' => ts('If set, new contacts that are created when signing a petition are assigned a tag of this name.'), + 'help_text' => '', ), 'petition_contacts' => array( 'group_name' => 'Campaign Preferences', 'group' => 'campaign', 'name' => 'petition_contacts', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'Petition Contacts', 'add' => '4.1', - 'title' => 'Petition Signers Group', + 'title' => ts('Petition Signers Group'), 'is_domain' => 1, 'is_contact' => 0, - 'description' => NULL, - 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + 'description' => ts('All contacts that have signed a CiviCampaign petition will be added to this group. The group will be created if it does not exist (it is required for email verification).'), + 'help_text' => '', ), ); -- 2.25.1