Problem/Motivation

When we add a term with more than 255 characters, the name is always truncated to 255 characters, even if the term name field is able to store more than 255 characters, either updating the DB schema or using a module like title_length, for example.

Steps to reproduce

  • Create a new Term Vocabulary.
  • Install the module title_length (composer require 'drupal/title_length:^2.0@RC').
  • Activate the module title_length and the submodule taxonomy_term_title_length (doing this, the term name field will increase to 500 characters)
  • Add the term below (with 446 characters) to the vocabulary using the Taxonomy Manager.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

This way, the term will be truncated to 255 characters even with the field name being able to store 500 characters.

taxonomy manager

Proposed resolution

We could use the service entity.last_installed_schema.repository to get the last installed storage definitions for taxonomy_term, using the method getLastInstalledFieldStorageDefinitions. This way, we will be able to retrieve the definitions for the field name and then, the setting max_length, containing the current value, equals 500.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rrmontuan created an issue. See original summary.

rrmontuan’s picture

StatusFileSize
new5.07 KB

Ignore this patch, it was created for the 2.0.4 version.

rrmontuan’s picture

Status: Active » Needs review
rrmontuan’s picture

StatusFileSize
new4.89 KB

Ignore this patch, some adjustments were needed.

rrmontuan’s picture

Version: 2.0.8 » 2.0.x-dev
rrmontuan’s picture

StatusFileSize
new5.22 KB

Hey, guys!

I did the changes accordingly to the proposed resolution.

Please, review it.

Thanks!

rrmontuan’s picture

Issue summary: View changes

sokru made their first commit to this issue’s fork.

sokru’s picture

Status: Needs review » Reviewed & tested by the community

Converted the patch from #6 into merge request and made minor coding standard fixes. Tested manually to be working, although I leave it up to maintainers if they require tests for this.

VladimirAus made their first commit to this issue’s fork.

  • VladimirAus committed ea2fe2f5 on 2.0.x authored by sokru
    Issue #3353522 by rrmontuan, sokru, VladimirAus: Consider field name...
vladimiraus’s picture

Status: Reviewed & tested by the community » Fixed

Thank you! Commited!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.