Commit eba92929 authored by eileen's avatar eileen

Fix multisite form to work off SettingTrait

parent a16f7743
......@@ -29,53 +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 multi site preferences
*
* This class generates form components for multi site preferences.
*/
class CRM_Admin_Form_Preferences_Multisite extends CRM_Admin_Form_Preferences {
public function preProcess() {
$msDoc = CRM_Utils_System::docURL2('Multi Site Installation', NULL, NULL, NULL, NULL, "wiki");
CRM_Utils_System::setTitle(ts('Multi Site Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME => array(
'is_enabled' => array(
'html_type' => 'checkbox',
'title' => ts('Enable Multi Site Configuration'),
'weight' => 1,
'description' => ts('Make CiviCRM aware of multiple domains. You should configure a domain group if enabled') . ' ' . $msDoc,
),
/** Remove this checkbox until some one knows what this setting does
* 'uniq_email_per_site' => array(
* 'html_type' => 'checkbox',
* 'title' => ts('Ensure multi sites have a unique email per site'),
* 'weight' => 2,
* 'description' => NULL,
* ),
*/
'domain_group_id' => array(
'html_type' => 'entity_reference',
'title' => ts('Domain Group'),
'weight' => 3,
'options' => array('entity' => 'group', 'select' => array('minimumInputLength' => 0)),
'description' => ts('Contacts created on this site are added to this group'),
),
/** Remove this checkbox until some one knows what this setting does
* 'event_price_set_domain_id' => array(
* 'html_type' => 'text',
* 'title' => ts('Domain for event price sets'),
* 'weight' => 4,
* 'description' => NULL,
* ),
*/
),
);
parent::preProcess();
}
protected $_settings = [
'is_enabled' => CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME,
'domain_group_id' => CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME,
];
}
......@@ -143,6 +143,11 @@ trait CRM_Admin_Form_SettingTrait {
$this->includesReadOnlyFields = TRUE;
}
if (isset($props['help_link'])) {
// Set both the value in this loop & the outer value as we assign both to the template while we deprecate the $descriptions assignment.
$settingMetaData[$setting]['description'] = $props['description'] .= ' ' . CRM_Utils_System::docURL2($props['help_link']['page'], NULL, NULL, NULL, NULL, $props['help_link']['resource']);
}
$add = 'add' . $quickFormType;
if ($add == 'addElement') {
$this->$add(
......@@ -180,6 +185,9 @@ trait CRM_Admin_Form_SettingTrait {
elseif ($add == 'addMonthDay') {
$this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d'));
}
elseif ($add === 'addEntityRef') {
$this->$add($setting, ts($props['title']), $props['entity_reference_options']);
}
else {
$this->$add($setting, ts($props['title']), $options);
}
......@@ -221,6 +229,7 @@ trait CRM_Admin_Form_SettingTrait {
'radio' => 'Radio',
'select' => 'Select',
'textarea' => 'Element',
'entity_reference' => 'EntityRef',
];
return $mapping[$spec['html_type']];
}
......
......@@ -29,10 +29,9 @@
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2017
* $Id$
*
*/
/*
/**
* Settings metadata file
*/
......@@ -41,26 +40,30 @@ return array(
'group_name' => 'Multi Site Preferences',
'group' => 'multisite',
'name' => 'is_enabled',
'title' => 'Multisite Is enabled',
'type' => 'Integer',
'title' => ts('Enable Multi Site Configuration'),
'html_type' => 'checkbox',
'type' => 'Boolean',
'default' => '0',
'add' => '4.1',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'Multisite is enabled',
'description' => ts('Make CiviCRM aware of multiple domains. You should configure a domain group if enabled'),
'help_link' => ['page' => 'Multi Site Installation', 'resource' => 'wiki'],
'help_text' => NULL,
),
'domain_group_id' => array(
'group_name' => 'Multi Site Preferences',
'group' => 'multisite',
'name' => 'domain_group_id',
'title' => 'Multisite Domain Group',
'title' => ts('Multisite Domain Group'),
'type' => 'Integer',
'html_type' => 'entity_reference',
'entity_reference_options' => ['entity' => 'group', 'select' => array('minimumInputLength' => 0)],
'default' => '0',
'add' => '4.1',
'is_domain' => 1,
'is_contact' => 0,
'description' => NULL,
'description' => ts('Contacts created on this site are added to this group'),
'help_text' => NULL,
),
'event_price_set_domain_id' => array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment