public function PullForm::validateSelectedEntities in Entity Share 8.2
Same name and namespace in other branches
- 8.3 modules/entity_share_client/src/Form/PullForm.php \Drupal\entity_share_client\Form\PullForm::validateSelectedEntities()
- 8 modules/entity_share_client/src/Form/PullForm.php \Drupal\entity_share_client\Form\PullForm::validateSelectedEntities()
Ensure at least one entity is selected.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- modules/
entity_share_client/ src/ Form/ PullForm.php, line 257
Class
- PullForm
- Form controller to pull entities.
Namespace
Drupal\entity_share_client\FormCode
public function validateSelectedEntities(array &$form, FormStateInterface $form_state) {
$selected_entities = $form_state
->getValue('entities');
if (!is_null($selected_entities)) {
$selected_entities = array_filter($selected_entities);
if (empty($selected_entities)) {
$form_state
->setErrorByName('entities', $this
->t('You must select at least one entity.'));
}
}
}