You are here

function double_field_field_storage_config_update in Double Field 8.3

Same name and namespace in other branches
  1. 4.x double_field.module \double_field_field_storage_config_update()

Implements hook_ENTITY_TYPE_update().

File

./double_field.module, line 75
Primary module hooks for Double Field module.

Code

function double_field_field_storage_config_update(EntityInterface $entity) {

  /* @var \Drupal\field\Entity\FieldStorageConfig  $entity */
  if ($entity
    ->getType() == 'double_field') {
    $settings = $entity
      ->getSettings();
    $original_settings = $entity->original
      ->getSettings();
    $first_type_is_changed = $settings['storage']['first']['type'] != $original_settings['storage']['first']['type'];
    $second_type_is_changed = $settings['storage']['second']['type'] != $original_settings['storage']['second']['type'];
    if ($first_type_is_changed || $second_type_is_changed) {
      \Drupal::messenger()
        ->addWarning(t('Since storage type has been changed you need to verify configuration of related widget on manage form display page.'));
    }
  }
}