Problem/Motivation
When a form element of '#type' => 'vertical_tab'
has '#access' => FALSE
, none of the elements contained by that vertical tab are present in the submitted values.
The docs for #access
say:
Whether the element is accessible or not; when FALSE, the element is not rendered and the user submitted value is not taken into consideration.
They don't clarify what happens to the #default_value
, but after consulting chx and davereid on IRC, I was assured that the default values would still be in the submitted values:
davereid: I would assume any element output with #access = FALSE to still retain it's FAPI #default_value on submission.
Steps to Reproduce
Write a custom module called access_false.module, with the following code:
/**
* Implements hook_form_BASE_FORM_ID_alter() for node_form.
*/
function access_false_form_node_form_alter(&$form, &$form_state, $form_id) {
$form['additional_settings']['#access'] = FALSE;
}
And then try to save a node. It will be unpublished, regardless of the default publishing settings for that content type.
Proposed resolution
TBD
Remaining tasks
Write test- TBD
User interface changes
N/A
API changes
Any custom code relying on this bug (denying access to a vertical tab to suppress all values including defaults) will break.