You are here

public function RiddlerSettingsForm::addMoreSubmit in Captcha Riddler 8

Submit function for ajax Add another riddle button.

Parameters

$form:

\Drupal\Core\Form\FormStateInterface $form_state:

File

src/Form/RiddlerSettingsForm.php, line 136

Class

RiddlerSettingsForm
Displays the Riddler settings form.

Namespace

Drupal\riddler\Form

Code

public function addMoreSubmit(&$form, FormStateInterface &$form_state) {
  $max = count($form_state
    ->getValues()['riddler']);
  $form_state
    ->setRebuildInfo([
    'riddler' => [
      'items_count' => ++$max,
    ],
  ]);
  $form_state
    ->setRebuild(TRUE);
}