When you lock a field, that field cannot be edited or deleted by any user using the Drupal user interface.

This is especially useful if you want to prevent anyone from accidentally deleting a field that is important to the site.

Locking a field involves 3 steps:

  1. Find the field storage configuration file. The file name follows the pattern of field.storage.[ENTITY TYPE ID].[FIELD MACHINE NAME]
  2. Update the locked property to true
  3. Import the configuration change

To unlock the field, repeat the process but set the locked property to false instead.

Tags