Validation function for adding/editing field states.
1 string reference to 'field_states_ui_validate'
- field_states_ui_settings_form dans ./
field_states_ui.admin.inc - Implements hook_field_widget_third_party_settings_form().
Fichier
-
./
field_states_ui.admin.inc, line 281
Code
function field_states_ui_validate($form, FormStateInterface $form_state) {
$trigger = $form_state->getTriggeringElement();
$field_name = $trigger['#field_name'];
$op = $trigger['#op'];
if ($op == 'add') {
$element = "fields][{$field_name}][settings_edit_form][third_party_settings][field_states_ui][form][type";
$type = $form_state->getValue([
'fields',
$field_name,
'settings_edit_form',
'third_party_settings',
'field_states_ui',
'form',
'type',
]);
if (!$type) {
$form_state->setErrorByName($element, t('You must select a field state to add.'));
}
}
}