Modify form structure and use core 'states' JS for each access plugin

Created on 28 March 2024, 8 months ago
Updated 24 July 2024, 4 months ago

Problem/Motivation

The alterations to the field config edit form add the access type options to the form array beneath a 'field_permissions' key
$form['field']['field_permissions']['type']

while the form elements of the custom access plugin (the only plugin in the module with such) are not so parented.
$form['permissions']

Also the former include an unnecessary 'field' key in the array structure.

The custom JS attached by the custom access plugin can be replaced with core 'states' JS. And the latter can be used to control visibility for all access plugins (including those not defined by this module). (Issue 3097655 recommends the same but only deals with the custom access plugin and then makes changes to that plugin. This is not future proof against additional access plugins from this or other modules.)

The CSS in the 'field_permissions' library is NOT used by the form elements added by the custom access plugin.

IMHO the form elements for field permissions should NOT display before those for the field settings, as the former are ancillary to the 'field configuration'.

Proposed resolution

Remove the 'field' array key.
Add 'field_permissions' key to form elements of each access plugin and invoke states JS.
Remove 'field_permissions' library from the form elements added by the custom access plugin.
Adjust the 'weight' of the form elements added by this module.

Remaining tasks

None.

User interface changes

None (other than moving the form elements down on the form).

API changes

None.

Data model changes

None.

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States solotandem

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024