You are here

public function BootstrapSiteAlertAdmin::addOne in Bootstrap Site Alert 8

Submit handler for the "Add Another Alert" button.

Increments the max counter and causes a rebuild.

File

src/Form/BootstrapSiteAlertAdmin.php, line 275

Class

BootstrapSiteAlertAdmin
Class BootstrapSiteAlertAdmin.

Namespace

Drupal\bootstrap_site_alert\Form

Code

public function addOne(array &$form, FormStateInterface $form_state) {
  $count = $form_state
    ->get('count');
  $add_button = $count + 1;
  $form_state
    ->set('count', $add_button);
  $form_state
    ->setRebuild();
  $this->ajaxPressed = TRUE;
}