Terms of use format can be NULL, causing error on submit

Created on 2 July 2025, 2 months ago

Problem/Motivation

When creating Terms and Conditions for the first time, if the text format on the "Terms & Conditions" has not yet been selected, it defaults to empty, due to the code:

      '#format'        => isset($conditions['format']) ? $conditions['format'] : filter_default_format(),

Format is empty, and it just renders as empty.

Steps to reproduce

1. Go to create Terms & Conditions for the first time admin/config/people/legal
2. Fill in the textbox for Terms & Conditions (required) and leave the Text format (required) on "- Select -"
3. Submit the form
4. Get an error (Cannot load the "filter_format" entity with NULL ID.)

Proposed resolution

Check if the filter format is empty rather than set.

Remaining tasks

Fix the code.

User interface changes

None - it will preload the filter formats and not show - Select -.

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇬🇧United Kingdom littlepixiez

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