public function ColorizedGmapBlock::removeCallback in Colorized google maps block 8
Submit handler for the "remove one" button.
Decrements the max counter and causes a form rebuild.
Parameters
array $form: Form array.
\Drupal\Core\Form\FormStateInterface $form_state: Form state.
File
- src/
Plugin/ Block/ ColorizedGmapBlock.php, line 589
Class
- ColorizedGmapBlock
- Provides a 'Example: configurable text string' block.
Namespace
Drupal\colorized_gmap\Plugin\BlockCode
public function removeCallback(array &$form, FormStateInterface $form_state) {
$name_field = $form_state
->get('num_names');
if ($name_field > 1) {
$remove_button = $name_field - 1;
$form_state
->set('num_names', $remove_button);
}
$form_state
->setRebuild();
}