You are here

public function AmswapConfigForm::amswap_add_pair in Admin Menu Swap 7.2

File

src/Form/AmswapConfigForm.php, line 100

Class

AmswapConfigForm
Class AmswapConfigForm.

Namespace

Drupal\amswap\Form

Code

public function amswap_add_pair(array $form, FormStateInterface &$form_state) {

  // Get the current number of pairs, or 1 if not provided
  $num_pairs = $form_state
    ->get('num_pairs');
  $num_pairs = $num_pairs ? $num_pairs : 1;

  // Add 1 to the number of role-menu pairs that should be displayed
  $form_state
    ->set('num_pairs', $num_pairs + 1);

  // Set the form to be rebuilt.
  $form_state
    ->setRebuild(TRUE);
}