public function GeolocationBlock::blockSubmit in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Block/GeolocationBlock.php \Drupal\geolocation\Plugin\Block\GeolocationBlock::blockSubmit()
Overrides BlockPluginTrait::blockSubmit
File
- src/
Plugin/ Block/ GeolocationBlock.php, line 253
Class
- GeolocationBlock
- Exposes a map rendered as a block.
Namespace
Drupal\geolocation\Plugin\BlockCode
public function blockSubmit($form, FormStateInterface $form_state) {
$this->configuration['map_provider_id'] = $form_state
->getValue('map_provider_id');
$this->configuration['map_provider_settings'] = $form_state
->getValue('map_provider_settings');
$this->configuration['centre'] = $form_state
->getValue('centre');
$this->configuration['locations'] = [];
foreach ($form_state
->getValue('locations') as $index => $location) {
if (!empty($location['marker_title']) && !empty($location['marker_content']) && !empty($location['marker_coordinates'])) {
$this->configuration['locations'][] = [
'marker_title' => $location['marker_title'],
'marker_content' => $location['marker_content'],
'marker_coordinates' => $location['marker_coordinates'],
];
}
}
}