*/
class CRM_Admin_Form_Setting_Mapping extends CRM_Admin_Form_Setting {
+ protected $_settings = array(
+ 'mapAPIKey' => CRM_Core_BAO_Setting::MAP_PREFERENCES_NAME,
+ 'mapProvider' => CRM_Core_BAO_Setting::MAP_PREFERENCES_NAME,
+ 'geoAPIKey' => CRM_Core_BAO_Setting::MAP_PREFERENCES_NAME,
+ 'geoProvider' => CRM_Core_BAO_Setting::MAP_PREFERENCES_NAME,
+ );
+
/**
* Build the form object.
*/
public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Settings - Mapping and Geocoding Providers'));
-
- $map = CRM_Core_SelectValues::mapProvider();
- $geo = CRM_Core_SelectValues::geoProvider();
- $this->addElement('select', 'mapProvider', ts('Mapping Provider'), array('' => '- select -') + $map, array('class' => 'crm-select2'));
- $this->add('text', 'mapAPIKey', ts('Map Provider Key'), NULL);
- $this->addElement('select', 'geoProvider', ts('Geocoding Provider'), array('' => '- select -') + $geo, array('class' => 'crm-select2'));
- $this->add('text', 'geoAPIKey', ts('Geo Provider Key'), NULL);
-
parent::buildQuickForm();
}
DIRECTORY_PREFERENCES_NAME = 'Directory Preferences',
EVENT_PREFERENCES_NAME = 'Event Preferences',
MAILING_PREFERENCES_NAME = 'Mailing Preferences',
+ MAP_PREFERENCES_NAME = 'Map Preferences',
CONTRIBUTE_PREFERENCES_NAME = 'Contribute Preferences',
MEMBER_PREFERENCES_NAME = 'Member Preferences',
MULTISITE_PREFERENCES_NAME = 'Multi Site Preferences',
public static function mapProvider() {
static $map = NULL;
if (!$map) {
- $map = CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
+ $map = array('' => '- select -') + CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
}
return $map;
}
public static function geoProvider() {
static $geo = NULL;
if (!$geo) {
- $geo = CRM_Utils_System::getPluginList('CRM/Utils/Geocode');
+ $geo = array('' => '- select -') + CRM_Utils_System::getPluginList('CRM/Utils/Geocode');
}
return $geo;
}
'geoAPIKey' => array(
'add' => '4.7',
'prefetch' => 1,
- 'config_only' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'geoProvider' => array(
'add' => '4.7',
'prefetch' => 1,
- 'config_only' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'group' => 'map',
'name' => 'geoProvider',
'type' => 'String',
- 'quick_form_type' => 'Element',
+ 'quick_form_type' => 'Select',
'html_type' => 'Select',
+ 'html_attributes' => array(
+ 'class' => 'crm-select2',
+ ),
'pseudoconstant' => array(
'callback' => 'CRM_Core_SelectValues::geoProvider',
),
'mapAPIKey' => array(
'add' => '4.7',
'prefetch' => 1,
- 'config_only' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'mapProvider' => array(
'add' => '4.7',
'prefetch' => 1,
- 'config_only' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'group' => 'map',
'name' => 'mapProvider',
'type' => 'String',
- 'quick_form_type' => 'Element',
- 'html_type' => 'Select ',
+ 'quick_form_type' => 'Select',
+ 'html_type' => 'Select',
+ 'html_attributes' => array(
+ 'class' => 'crm-select2',
+ ),
'pseudoconstant' => array(
'callback' => 'CRM_Core_SelectValues::mapProvider',
),