Content item widget autocomplete has maxlength shorter than allowed node titles

Created on 21 April 2025, 4 days ago

Problem/Motivation

The Content Item widget has an autocomplete to help find the content item by its title. The autocomplete field falls back to core's default 128-character max length, but node titles can be up to 255 characters long. This results in an error when trying to place the node as a content item widget.

There is a long-standing core issue to remove or update the fallback maxlength attribute, see ✨ Increase or remove default textfield #maxlength=128 Active . But it's unclear if/when that will be committed.

Also this was fixed a few years ago in Panopoly 1.x for Drupal 7, see #3213290: "Content item" widget gives validation error if attempting to use a piece of content with a title longer than 128 characters β†’ . But this should be simpler in Panopoly 3.0.x because the widget is its own plugin, it's not using Views. All that's needed is to add the appropriate maxlength attribute in the block plugin.

Steps to reproduce

Install the latest Panopoly 3.0.x dev with the defaults including starter content.
Create a Content page with a node title of longer than 128 characters.
Create a Landing page.
In the Layout tab on the Landing page, add a Content Item widget.
In the Piece of Content field, start typing the title of the Content page you created.
Select the autocomplete result.
Note the error message in the preview: Piece of content cannot be longer than 128 characters but is currently 152 characters long.

Proposed resolution

Add a maxlength attribute to the block plugin form.

Remaining tasks

Patch and test.

User interface changes

Piece of Content field will allow up to 255 characters for the selected node title.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Active

Version

3.0

Component

Widgets

Created by

πŸ‡ΊπŸ‡ΈUnited States cboyden

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

Comments & Activities

Production build 0.71.5 2024