Add a hook to alter the form when read only mode is enabled

Created on 6 July 2023, over 1 year ago

Problem/Motivation

The wrapping div classes of the message that replaces a form when read only mode is enabled aren't correct for the alert messages in our theme.

We need to change class="messages warning" to class="alert alert-warning"

Proposed resolution

Add a hook to alter the form when read only mode is enabled.

In our theme we then can add THEME_readonlymode_form_alter() to make the change.

We decided to do this rather than add a setting for the message wrapper classes as we thought it would provide greater flexibility should we require to add or alter other elements in the form array when read only mode is enabled.

Feature request
Status

Active

Version

2.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024