Hide required field 'usa_tax_id', if the field 'event_number' in parent node looks like 'DE-123abc-2024':
function MY_MODULE_form_alter(&$form, &$form_state, $form_id)
$node = $form_state->getFormObject()->getEntity();
$event_number = $node->get('event_number')->value ?? '';
if( preg_match("#^D.*2024$#simU", $event_number) ) {
$form['elements']['usa_tax_id']['#access'] = FALSE;
}
}
File: web/module/custom/MY_MODULE/MY_MODULE.module
Neuen Kommentar schreiben