Skip to content

Instantly share code, notes, and snippets.

@alexpott
Created March 14, 2013 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexpott/5161576 to your computer and use it in GitHub Desktop.
Save alexpott/5161576 to your computer and use it in GitHub Desktop.
Field CMI moving from objects to arrays...
function hook_field_attach_purge(\Drupal\Core\Entity\EntityInterface $entity, $field, $instance) {
// find the corresponding data in mymodule and purge it
- if ($entity->entityType() == 'node' && $field->field_name == 'my_field_name') {
+ if ($entity->entityType() == 'node' && $field['field_name'] == 'my_field_name') {
mymodule_remove_mydata($entity->nid);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment