Naming convention in drupal 8

I struggle with coming up with machine names for fields in Drupal. When a field is created, Drupal creates database structure using those names. As for most of the projects, I tend to use incremental methodology. At times I’m forced to change the field names.

The human-readable title can be changed at any time, however, the code behind in the theme and modules needs to use the original machine names. This makes the code significantly less readable.

I attempted to change the old field name by manipulating MySQL database, however, this is problematic in many ways. References to the field in the database, caching and synchronization is so interconnected that I wouldn’t risk changing it, especially on large, populated systems.

It’s much easier to delete a field and create a new field. Overkill on a larger website with tons of content.

Leave a comment

Your email address will not be published. Required fields are marked *