Problem/Motivation

The title_length_install() function does not respect $settings['node_title_length_chars'] when updating the definition for the title field:

$fields['title']->setSetting('max_length', 500);

Steps to reproduce

1. Set $settings['node_title_length_chars'] = 2000; in settings.php
2. Enable this module
3. Get the "Mismatched entity and/or field definitions" in the status report page (/admin/reports/status)

Proposed resolution

$fields['title']->setSetting('max_length', 500);

should be

$fields['title']->setSetting('max_length', $length);
CommentFileSizeAuthor
#2 fix-hook-install.patch620 bytesstefan.butura

Comments

stefan.butura created an issue. See original summary.

stefan.butura’s picture

StatusFileSize
new620 bytes
vagelis-prokopiou’s picture

Status: Active » Reviewed & tested by the community

The patch works as described/expected.

ivnish’s picture

Confirm. It works

ivnish’s picture

If you want to update field after module installing, update settings.php and run drush php-eval "module_load_install('title_length'); title_length_install();"

seth.e.shaw’s picture

I can also confirm this works on D 9.2.5. I've sent a message to @cbccharlie via the Drupal contact form; so hopefully we can get this in and tagged.

cbccharlie’s picture

Excuse me, but I had forgotten to check this issue. I hope I can review it this week and create a new version. Thank you!

cbccharlie’s picture

Assigned: Unassigned » cbccharlie
Status: Reviewed & tested by the community » Fixed
cbccharlie’s picture

Status: Fixed » Closed (fixed)