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.
When I replace the title field on a content type with this title instance, regardless if I have any data in that content type or not, I am not allowed to change the max field length from 255 characters?
I need to be able to change this. How do I do it?
Thanks
Comment | File | Size | Author |
---|---|---|---|
#4 | title-max_length-1668570-4.patch | 1.7 KB | Volx |
Comments
Comment #1
IWasBornToWin CreditAttribution: IWasBornToWin commentedAny suggestions?
Comment #2
jacobpov CreditAttribution: jacobpov commentedYeah same problem here I wonder how to change it ?
Comment #3
IWasBornToWin CreditAttribution: IWasBornToWin commentedI installed validate module and set restrictions there.
Comment #4
Volx CreditAttribution: Volx commentedI created a patch with a new configuration setting. On the title configuration page admin/config/content/title in the "General" tab you can set the maximum field length.
But beware that this can only take effect when no title field has been created for the specific entity type, i.e. if you have a title field for one node type and want to add a title field for another node type the setting will have no effect, since the database table for the field has already been created with the initial field length.
If you want to change the field length for an existing field I think you could change that directly in the database by changing the field config in the data column of the field_config table AND change the the actual datatype for the title_field_value column in the field_data_title_field and the field_revision_title_field tables.
Comment #5
fox_01 CreditAttribution: fox_01 commentedWhy isn't it possible to change the length from existing fields by changing the settings in your new form? This would be great.
Comment #6
Volx CreditAttribution: Volx commentedIt would be indeed, but the setting influences how the database table for the title field is created, i.e. the length of the field. Because there is only one title field (only instances are created after the first one), they all use the same database table.
I don't think it is feasable to change the database automatically, because this may cause a lot of issues with content. If you need to change it, you can do so manually without much work as I have written above.
Comment #7
fox_01 CreditAttribution: fox_01 commentedOk. Is it normal that the field setting show 50 character even if I changed the databse settings how you described above?
Comment #8
Volx CreditAttribution: Volx commentedYes, the setting will have no effect after the database table has been created and will not be synchronized with the database, but you can still change the setting to match the database so you will not be confused in a year from now :)
Comment #9
fox_01 CreditAttribution: fox_01 commentedHow do you adivce to modify the data column which is a serialized binary? Thats looks not as easy as editing a normal column.
Comment #10
pifagorComment #12
pifagor