Problem/Motivation
It is difficult, currently, to hide a core field definition from a user and apply access controls as webform submissions bypass Drupal's usual field access hooks.
It would be a great feature to add a hook so that certain base definitions are able to be hidden in various contexts. The ones I see most relevant being:
- the results table
- wherever entities are printed (downloads etc)
Steps to reproduce
1. Try to hide remote IP conditionally from results table and entity print
Proposed resolution
Add in a hook in the checkFieldDefinitionAccess function to allow other modules to unset field definitions and remove them from display.
Remaining tasks
Add tests.
User interface changes
N/A
API changes
New hook: hook_webform_submission_field_definition_access_alter().
Ability to unset field definition keys and hide them from results tables/exports.
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3534453-base-definitions-access-hook.patch | 3.5 KB | littlepixiez |
Issue fork webform-3534453
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
littlepixiez commentedI will need to add a test to this, but would love feedback on whether the webform community think this is a good idea and whether this hook should touch logic in the results table as well as in the original function.
Comment #4
littlepixiez commentedAlso adding a patch here for Webform 6.2.x, as webform.api.php isn't using namespaced vars in that version.
Comment #5
jrockowitz commentedAny access control improvement will need some test coverage.
Comment #7
jrockowitz commentedI think this is edge case feature that should be addressed in a dedicated contributed module. OOTB the Submission List builder can be replaced with views that hide default properties.