You are here

public function SalesforceAuthDeleteForm::validateForm in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 5.0.x src/Form/SalesforceAuthDeleteForm.php \Drupal\salesforce\Form\SalesforceAuthDeleteForm::validateForm()

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

src/Form/SalesforceAuthDeleteForm.php, line 38

Class

SalesforceAuthDeleteForm
Class SalesforceAuthDeleteForm.

Namespace

Drupal\salesforce\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if ($form_state
    ->getErrors()) {
    return;
  }
  if (\Drupal::config('salesforce.settings')
    ->get('salesforce_auth_provider') == $this->entity
    ->id()) {
    $form_state
      ->setError($form, $this
      ->t('You cannot delete the default auth provider. Please <a href="@href">assign a new auth provider</a> before deleting the active one.', [
      '@href' => Url::fromRoute('salesforce.auth_config')
        ->toString(),
    ]));
  }
}