You are here

function shrinktheweb_field_purge_field in ShrinkTheWeb 8

Implements hook_field_purge_field().

File

./shrinktheweb.module, line 406

Code

function shrinktheweb_field_purge_field(\Drupal\field\Entity\FieldConfig $field) {
  $shrinktheweb_fields = \Drupal::database()
    ->select('shrinktheweb_fields', 't')
    ->fields('t', array(
    'stw_field_name',
  ))
    ->condition('stw_field_name', $field
    ->getName())
    ->execute()
    ->fetchCol();
  if (in_array($field
    ->getName(), $shrinktheweb_fields)) {
    \Drupal::database()
      ->delete('shrinktheweb_fields')
      ->condition('stw_field_name', $field
      ->getName(), '=')
      ->execute();
  }
}