Last active
March 3, 2017 16:07
-
-
Save crittermike/8d2b81ff311fbcce398976c8f65fa1f8 to your computer and use it in GitHub Desktop.
How to delete and purge a field in Drupal 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Usually, you'll want to run this inside an update hook. | |
$field = FieldStorageConfig::loadByName($entity_type, $field_name); | |
$field->delete(); | |
field_purge_field($field); // This part also happens automatically when cron runs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment