On a Webform using the PdvRecordMap handler, when the owner's vault is passphrase-locked the form correctly shows the "Unlock my vault" prompt and hides the record store-consent checkboxes. But a pdv_file element's "Save or update this file in my vault for reuse" checkbox is still rendered, even though a write cannot succeed while the vault is locked.
Steps to reproduce
- Enable an owner passphrase and lock the vault.
- Open a Webform that maps a
pdv_fileelement with #offer_vault_save (for example the consent-required onboarding demo form). - The unlock prompt appears and the record store-consent boxes are hidden, but the file "Save ... for reuse" checkbox remains.
Cause
The pdv_file save controls (save_to_vault / save_kind) are composite children built in the element #process pass, which runs after the handler's alterForm. At the time hideSaveControls() runs they are not yet keys in the form array, so hiding them by key is a no-op. The record store-consent checkboxes are real top-level elements, so they hide correctly.
Fix
Clear #offer_vault_save on every pdv_file element on the locked and unreachable-vault paths. The composite reads that flag when it later builds its children (PdvFile::saveToVaultElement returns nothing when it is falsy), so the save controls are never emitted: the same lever that already self-hides them for an anonymous submitter. A kernel test covers the locked case.
Issue fork pdv-3595220
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedComment #5
mably commented