I am trying to do something that should be extremely easy in drupal. I just want to simply hide a form field in the drupal admin by default.
Making the field disabled simply doesn't work. I cannot find any documentation for this. It's unbelievable that it's this hard to do something so simple in Drupal.
$form['field_name']['#states'] = [
'visible' => [
':input[name="field_foo[0][target_id]"]' => ['value' => 'blah'],
],
'invisible' => true,
];
The visible part works. If another field has a certain value, then show the form element.
But I simply cannot get it to hide this field on default when you're adding a new node.