public function ModalForm::validateForm in Entity Reference View Widget 8
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
- src/
Form/ ModalForm.php, line 87 - Contains \Drupal\entity_reference_view_widget\Form\ModalForm.
Class
- ModalForm
- Provides the database logging filter form.
Namespace
Drupal\entity_reference_view_widget\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$settings = $form_state
->get('ervw_settings');
$input = $form_state
->getUserInput();
if (!empty($input['entity_ids'])) {
if ($settings['cardinality'] > 0 && $settings['cardinality'] < count($input['entity_ids'])) {
drupal_set_message(t('Please select no more than @cardinality values', array(
'@cardinality' => $settings['cardinality'],
)), 'error');
}
}
}