public function GeolocationBlock::addCallback in Geolocation Field 8.3
Add location.
Parameters
array $form: Current form.
\Drupal\Core\Form\FormStateInterface $form_state: Current form state.
File
- src/
Plugin/ Block/ GeolocationBlock.php, line 239
Class
- GeolocationBlock
- Exposes a map rendered as a block.
Namespace
Drupal\geolocation\Plugin\BlockCode
public function addCallback(array &$form, FormStateInterface &$form_state) {
$locations = $form_state
->get('locations');
$locations[] = [
'marker_title' => '',
'marker_content' => [
'value' => '',
'format' => filter_default_format(),
],
'marker_coordinates' => [],
];
$form_state
->set('locations', $locations);
$form_state
->setRebuild();
}