public function OpmlFeedAdd::validateForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/aggregator/src/Form/OpmlFeedAdd.php \Drupal\aggregator\Form\OpmlFeedAdd::validateForm()
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
- core/modules/ aggregator/ src/ Form/ OpmlFeedAdd.php, line 105 
- Contains \Drupal\aggregator\Form\OpmlFeedAdd.
Class
- OpmlFeedAdd
- Imports feeds from OPML.
Namespace
Drupal\aggregator\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
  // If both fields are empty or filled, cancel.
  $file_upload = $this
    ->getRequest()->files
    ->get('files[upload]', NULL, TRUE);
  if ($form_state
    ->isValueEmpty('remote') == empty($file_upload)) {
    $form_state
      ->setErrorByName('remote', $this
      ->t('<em>Either</em> upload a file or enter a URL.'));
  }
}