You are here

public function IdpForm::removeCertCallback in SAML Service Provider 3.x

Same name and namespace in other branches
  1. 8.3 src/Form/IdpForm.php \Drupal\saml_sp\Form\IdpForm::removeCertCallback()
  2. 8.2 src/Form/IdpForm.php \Drupal\saml_sp\Form\IdpForm::removeCertCallback()
  3. 4.x src/Form/IdpForm.php \Drupal\saml_sp\Form\IdpForm::removeCertCallback()

Submit handler for the "remove cert" button.

Decrements the max counter and causes a form rebuild.

File

src/Form/IdpForm.php, line 273

Class

IdpForm
Provides the form to configure the IdP.

Namespace

Drupal\saml_sp\Form

Code

public function removeCertCallback(array &$form, FormStateInterface $form_state) {
  $cert_field = $form_state
    ->get('num_certs');
  if ($cert_field > 1) {
    $remove_button = $cert_field - 1;
    $form_state
      ->set('num_certs', $remove_button);
  }
  $form_state
    ->setRebuild();
}