You are here

public function ColorizedGmapBlock::stylesRemoveOne 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 570

Class

ColorizedGmapBlock
Provides a 'Example: configurable text string' block.

Namespace

Drupal\colorized_gmap\Plugin\Block

Code

public function stylesRemoveOne(array &$form, FormStateInterface $form_state) {
  $styles_count = $form_state
    ->get('styles_count');
  if ($styles_count > 1) {
    $styles_count--;
    $form_state
      ->set('styles_count', $styles_count);
  }
  $form_state
    ->setRebuild();
}