public function OAuthKeyForm::validateDestinationExists in Lightning API 8.3
Same name and namespace in other branches
- 8.4 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateDestinationExists()
- 8 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateDestinationExists()
- 8.2 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateDestinationExists()
Ensures that the destination directory exists.
Parameters
array $element: The form element being validated.
\Drupal\Core\Form\FormStateInterface $form_state: The current form state.
File
- src/
Form/ OAuthKeyForm.php, line 142
Class
- OAuthKeyForm
- Provides a form for generating OAuth key pairs in the UI.
Namespace
Drupal\lightning_api\FormCode
public function validateDestinationExists(array &$element, FormStateInterface $form_state) {
$dir = $element['#value'];
if (is_dir($dir) == FALSE) {
$form_state
->setError($element, $this
->t('%dir does not exist.', [
'%dir' => $dir,
]));
}
}