public function ColorizedGmapBlock::blockSubmit in Colorized google maps block 8
Overrides BlockPluginTrait::blockSubmit
File
- src/
Plugin/ Block/ ColorizedGmapBlock.php, line 161
Class
- ColorizedGmapBlock
- Provides a 'Example: configurable text string' block.
Namespace
Drupal\colorized_gmap\Plugin\BlockCode
public function blockSubmit($form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
$this->configuration['coordinates'] = $values['coordinates'];
$this->configuration['colorized_map_styles'] = $values['colorized_map_styles'];
$this->configuration['additional_settings'] = $values['additional_settings'];
// Save entity id in the block configuration page.
// I cannot get block id on block build
// so I save entity id in such ugly way.
// todo: need to change it somehow.
$user_input = $form_state
->getUserInput();
if (isset($user_input['id']) && $user_input['id']) {
$this->configuration['machine_name'] = $user_input['id'];
}
// Process file save marker.
// if ($values['additional_settings']['marker_settings']['marker'][0]) {
// // Remove previous file.
// $fid = $values['additional_settings']['marker_settings']['marker'][0];
// $file = \Drupal::entityTypeManager()->getStorage('file')->load($fid);
// $file->delete();
//
// // Save new one.
// $fid = $values['additional_settings']['marker_settings']['marker'][0];
// $file = \Drupal::entityTypeManager()->getStorage('file')->load($fid);
// $file->setPermanent();
// $file->save();
// }
}