public function SamlSpConfigSPForm::validateForm in SAML Service Provider 7.8
File
- src/
Form/ SamlSpConfigSPForm.php, line 47 - Contains \Drupal\saml_sp\Form\SamlSpConfigSPForm.
Class
Namespace
Drupal\saml_sp\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
// ensure the cert and key files are provided and exist in the system
$values = $form_state
->getValues();
foreach ([
'key_location',
'cert_location',
] as $key) {
if (empty($values[$key])) {
$form_state
->setError($form[$key], $this
->t('The %field must be provided.', array(
'%field' => $form[$key]['#title'],
)));
}
else {
if (!file_exists($values[$key])) {
$form_state
->setError($form[$key], $this
->t('The %input file does not exist.', array(
'%input' => $values[$key],
)));
}
}
}
}