public OpmlFeedAdd::validateForm(array &$form, FormStateInterface $form_state)
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 100
Class
- OpmlFeedAdd
- Imports feeds from OPML.
Namespace
Drupal\aggregator\Form
Code
public function validateForm(array &$form, FormStateInterface $form_state) { // If both fields are empty or filled, cancel. $all_files = $this->getRequest()->files->get('files', []); if ($form_state->isValueEmpty('remote') == empty($all_files['upload'])) { $form_state->setErrorByName('remote', $this->t('<em>Either</em> upload a file or enter a URL.')); } }
Please login to continue.