You are here

public function ActionsForm::validateConfigValidateForm in S3 File System 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Form/ActionsForm.php \Drupal\s3fs\Form\ActionsForm::validateConfigValidateForm()

Validate current configuration.

Parameters

array $form: Array that contains the structure of the form.

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

2 calls to ActionsForm::validateConfigValidateForm()
ActionsForm::copyLocalValidateForm in src/Form/ActionsForm.php
Validates the form.
ActionsForm::refreshCacheValidateForm in src/Form/ActionsForm.php
Refreshes in form validation.

File

src/Form/ActionsForm.php, line 192

Class

ActionsForm
Defines an actions form.

Namespace

Drupal\s3fs\Form

Code

public function validateConfigValidateForm(array &$form, FormStateInterface $form_state) {
  $config = \Drupal::config('s3fs.settings')
    ->get();
  if ($errors = \Drupal::service('s3fs')
    ->validate($config)) {
    $errorText = $this
      ->t("Unable to validate your s3fs configuration settings. Please configure S3 File System from the admin/config/media/s3fs page or settings.php and try again.");
    foreach ($errors as $error) {
      $errorText .= "<br>\n" . $error;
    }
    $form_state
      ->setError($form, new FormattableMarkup($errorText, []));
  }
}