Open JPustkuchen opened 6 years ago
PS: My current (bad & insecure) workaround is:
<?php
$form['event']['rng_registrants_maximum']['#attributes']['class'] = array('hidden');
$form['event']['rng_registrants_minimum']['#attributes']['class'] = array('hidden');
?>
When settings #access=FALSE; on an unlimited_number field the default value is not being saved. Instead the value is being reset to null. This isn't the right behaviour but seems to happen because of the compund nature of the widget, like similar issues from other projects here: https://www.drupal.org/project/date/issues/1267434 https://www.drupal.org/project/profile2/issues/1366534
My concrete example: I wanted to hide settings in the rng admin form which the website owners shell never change:
If #access is not set everything works fine and the default is set and saved. When setting #access=false to hide the field and prevent changing the value, the value is always set to NULL. The correct Drupal FAPI behaviour would be to save the #default_value.