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.
The documentation should mention that the maximum length of the info attribute is 32 characters. I have a module with a particularly long name (pending_user_notification) and in trying to namespace my block, I was receiving an error when attempting to go to the block management page.
Comment | File | Size | Author |
---|---|---|---|
#8 | 1025372.patch | 808 bytes | rschwab |
#4 | 1025372.patch | 847 bytes | rschwab |
Comments
Comment #1
jhodgdonHmmmm....
The maximum length of the array key on the return value (the "delta") is 32 bytes, as you can see from block_schema():
I think that is what you are talking about, since you mention a value of 'pending_user_notification'. That would typically be a block delta, not a 'info' element. I agree this maximum should be documented, and it isn't currently.
I don't think there's really a maximum length for the 'info' element of the return value though -- that is the default human-readable title for the block, and it is not stored in the database as far as I can tell. I looked through _block_rehash(), which builds the block list for the block admin page, and I'm not seeing any usage of the 'info' component that would have a maximum length.
There is also a maximum length for the human-readable title that someone configures in the user interface, which is apparently 64 bytes:
So I'm assuming you meant the array key and not the 'info' component? If not, what error are you getting?
Comment #2
Jaypan CreditAttribution: Jaypan commentedYes, I am referring to the delta, the key of the array. 32 bytes actually seems a little small to me (because of namespacing), but if it's going to be 32, then it should at least be documented. I was able to debug it from the error message and seeing the size in the database, but I know error messages like that can be confusing for some people, particularly when learning a new system.
Comment #3
jhodgdonAgreed, the 32 byte limit of delta needs to be documented. Good project for a novice doc contributor.
Comment #4
rschwab CreditAttribution: rschwab commentedThis patch adds "The maximum length for delta values is 32 characters." to the paragraph describing delta values.
Comment #5
Jaypan CreditAttribution: Jaypan commentedLooks good to me.
Comment #6
jhodgdonThe maximum length is 32 *bytes*, not 32 characters. Not the same thing in, for instance, Japanese.
Comment #7
Jaypan CreditAttribution: Jaypan commentedHeh, I'm in Japan and should have realized that!
Comment #8
rschwab CreditAttribution: rschwab commentedOops! This one changes 'characters' to 'bytes'.
Comment #9
jhodgdonLooks fine, thanks!
Comment #10
jhodgdon#8: 1025372.patch queued for re-testing.
Comment #11
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #14
donquixote CreditAttribution: donquixote commentedSee also #2182201: block_schema(): Change block.delta from varchar(32) to varchar(64)