public function ConfigPartialExportForm::validateForm in Config Partial Export 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/ ConfigPartialExportForm.php, line 167
Class
- ConfigPartialExportForm
- Construct the storage changes in a configuration synchronization form.
Namespace
Drupal\config_partial_export\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$user_input = $form_state
->getUserInput();
$count = 0;
if (!empty($user_input)) {
foreach ($user_input['change_list'] as $change_item) {
if ($change_item) {
$count++;
}
}
}
if ((empty($user_input['change_list']) || !$count) && empty($user_input['addSystemSiteInfo'])) {
$form_state
->setErrorByName('', $this
->t('No items selected.'));
}
}