public function OAuthKeyForm::validateKeyFileName in Lightning API 8.4
Same name and namespace in other branches
- 8 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateKeyFileName()
- 8.2 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateKeyFileName()
- 8.3 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateKeyFileName()
Ensures that a requested file name contains no illegal characters.
Parameters
array $element: The form element being validated.
\Drupal\Core\Form\FormStateInterface $form_state: The current form state.
File
- src/
Form/ OAuthKeyForm.php, line 161
Class
- OAuthKeyForm
- Provides a form for generating oAuth key pairs.
Namespace
Drupal\lightning_api\FormCode
public function validateKeyFileName(array &$element, FormStateInterface $form_state) {
$value = $element['#value'];
if (strpos($value, '/') !== FALSE) {
$form_state
->setError($element, $this
->t('%value is not a valid name for a key file.', [
'%value' => $value,
]));
}
}