Skip to content

Instantly share code, notes, and snippets.

@Seorusus
Last active November 8, 2022 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seorusus/400cc5ef5be1197ca2d20fc2fa2fe10d to your computer and use it in GitHub Desktop.
Save Seorusus/400cc5ef5be1197ca2d20fc2fa2fe10d to your computer and use it in GitHub Desktop.
Drupal 9 Валидация поля select
case 'organism_cta':
switch ($entityType) {
case 'overview':
// Adds field_align validation.
$element['subform']['field_media']['widget']['#required'] = TRUE;
$element["subform"]["field_align"]['#attributes']['name'] = 'field_align';
$element["subform"]["field_media"]['#states'] = [
'invisible' => [
':input[name="field_call_to_action[0][subform][field_align]"]' => [
'value' => 'center',
],
],
];
}
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment