public function OAuthKeyForm::validateDestinationExists in Lightning API 8
Same name and namespace in other branches
- 8.4 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateDestinationExists()
 - 8.2 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateDestinationExists()
 - 8.3 src/Form/OAuthKeyForm.php \Drupal\lightning_api\Form\OAuthKeyForm::validateDestinationExists()
 
Ensures that the destination directory exists.
Parameters
array $element: The form element being validated.
FormStateInterface $form_state: The current form state.
File
- src/
Form/ OAuthKeyForm.php, line 139  
Class
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,
    ]));
  }
}