Drupal - Character limit of field machine name?

Yes the length of the field name is hard-coded to 32 characters. It's most likely because the maximum length for a table name in MySQL is 64 characters, and the field API creates tables with names like field_revision_field_name. I imagine the core developers were erring on the side of caution.

It looks like you could squeeze an extra 17 characters out of the field name (64 - 32 - len('field_revision_')), but to do that you'll need to alter the field_config and field_config_instance tables in the database to increase the length of the field_name column (I guess to 49 characters).

I would imagine you'll also need to hook into the field UI forms to increase the #maxlength of appropriate text fields.

It might be easier to re-think your matching logic :)

Tags:

Entities