function ip_geoloc_save_map_options in IP Geolocation Views & Maps 8
Same name and namespace in other branches
- 7 ip_geoloc_blocks.inc \ip_geoloc_save_map_options()
Save map options to a Drupal variable.
Parameters
string $var_name: The variable name to save.
string $map_options: The map options to save.
2 calls to ip_geoloc_save_map_options()
- CurrentVisitorMapBlock::blockSubmit in src/
Plugin/ Block/ CurrentVisitorMapBlock.php - RecentVisistorsMapBlock::blockSubmit in src/
Plugin/ Block/ RecentVisistorsMapBlock.php
File
- ./
ip_geoloc_blocks.inc, line 18 - Blocks available in IP Geolocation Views & Maps.
Code
function ip_geoloc_save_map_options($var_name, $map_options) {
// @TODO map option sends error
$map_options_decoded = Json::decode($map_options);
if ($map_options_decoded == NULL) {
\Drupal::messenger()
->addMessage("Sytax error in map options. These map options may not work: '%map_options'", 'warning');
// @TODO fix translation
// drupal_set_message(t("Sytax error in map options. These map options may not work: '%map_options'", array('%map_options' => $map_options)), 'warning');
}
$config = \Drupal::service('config.factory')
->getEditable('ip_geoloc.settings');
$config
->set($var_name, $map_options);
}