Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Steps to reproduce:
- Enable custom block module
- Goto
admin/structure/block/custom-blocks/types/add
and create a type with a machine name longer than 32 characters - Goto
block/add?destination=admin%2Fstructure%2Fblock%2Fcustom-blocks
and click on the new type to add a custom block of that type - Complete Add block form
- Get error
Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'type'
Proposed resolution
Limit custom block type name to 32 characters - it's enough.
Remaining tasks
- Patch
- Review
User interface changes
The custom block type machine name will be limited to 32 characters instead of 64. The label will still be able to be as long as the user wishes
API changes
Enforce the limit of 32 characters in the API.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2220739.1.patch | 5.19 KB | alexpott |
Comments
Comment #1
alexpottComment #2
BerdirNote that #1709960: declare a maximum length for entity and bundle machine names does the opposite right now, it increases the size of the bundle column to 64, which is the limit that has been suggested there. This is fine with me as well, we just need to be doing the same.
Edit: Fixed wrong reference.
Comment #3
zserno CreditAttribution: zserno commentedWe are working towards a general entity bundle name length limitation in #1709960: declare a maximum length for entity and bundle machine names. Patch in #50 includes the ideas from this issue's #1, so this might be marked as duplicate.
Comment #4
BerdirYep, agreed, happening there now.