You are here

function apigee_edge_field_config_delete in Apigee Edge 8

Implements hook_field_config_delete().

Removes field name from the module's configuration after deleting the field.

File

./apigee_edge.module, line 1492
Copyright 2018 Google Inc.

Code

function apigee_edge_field_config_delete(EntityInterface $entity) {

  /** @var \Drupal\field\FieldConfigInterface $entity */
  $user_fields_to_sync = \Drupal::configFactory()
    ->get('apigee_edge.sync')
    ->get('user_fields_to_sync');
  \Drupal::configFactory()
    ->getEditable('apigee_edge.sync')
    ->set('user_fields_to_sync', array_diff($user_fields_to_sync, [
    $entity
      ->getName(),
  ]))
    ->save();
}