public function PushNotificationsConfigForm::validateForm in Push Notifications 8
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/ PushNotificationsConfigForm.php, line 139
Class
- PushNotificationsConfigForm
- Class PushNotificationsConfigForm.
Namespace
Drupal\push_notifications\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
// If custom certificate directory is set, ensure the directory exists.
$custom_dir = $form_state
->getValue('apns_certificate_folder');
if (!empty($custom_dir)) {
if (!file_exists(Html::escape($custom_dir))) {
$form_state
->setErrorByName('apns_certificate_folder', $this
->t('Custom certificate directory does not exist. Please create the path before saving your configuration.'));
}
}
}