public function OpmlFeedAdd::validateForm

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: An associative array containing the current state of the form.

Overrides FormInterface::validateForm

File

drupal/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php, line 146
Contains \Drupal\aggregator\Form\OpmlFeedAdd.

Class

OpmlFeedAdd
Imports feeds from OPML.

Namespace

Drupal\aggregator\Form

Code

public function validateForm(array &$form, array &$form_state) {

  // If both fields are empty or filled, cancel.
  if (empty($form_state['values']['remote']) == empty($_FILES['files']['name']['upload'])) {
    form_set_error('remote', t('You must <em>either</em> upload a file or enter a URL.'));
  }
}