Problem/Motivation

Steps to reproduce:

  1. Enable custom block module
  2. Goto admin/structure/block/custom-blocks/types/add and create a type with a machine name longer than 32 characters
  3. Goto block/add?destination=admin%2Fstructure%2Fblock%2Fcustom-blocks and click on the new type to add a custom block of that type
  4. Complete Add block form
  5. 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.

CommentFileSizeAuthor
#1 2220739.1.patch5.19 KBalexpott
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott’s picture

Issue summary: View changes
Status: Active » Needs review
Issue tags: -Needs tests
FileSize
5.19 KB
Berdir’s picture

Note 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.

zserno’s picture

We 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.

Berdir’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#1709960: declare a maximum length for entity and bundle machine names

Yep, agreed, happening there now.