You are here

function media_entity_update_dependencies in Media entity 8.2

Implements hook_update_dependencies().

File

./media_entity.install, line 596
Install, uninstall and update hooks for Media entity module.

Code

function media_entity_update_dependencies() {
  $dependencies = [];

  // Ensure that media_entity_update_8200() comes before other updates. This
  // ensures that the fake media entity declared in
  // media_entity_entity_type_build() is available and code doesn't try to use
  // the old entity type that no longer exists. For example,
  // system_update_8402() and system_update_8501() both fail if
  // media_entity_update_8200() is not called first.
  foreach (update_get_update_list() as $module => $updates) {
    if ($module === 'media_entity') {
      continue;
    }
    if (!empty($updates['pending'])) {
      $first_update = key($updates['pending']);
      $dependencies[$module][$first_update]['media_entity'] = 8200;
    }
  }
  if (version_compare(\Drupal::VERSION, '8.8', '>=')) {

    // Ensure that system_update_8803() run before the media update, so that the
    // new path_alias module is installed.
    $dependencies['media_entity'][8201]['system'] = 8803;
  }
  else {

    // Ensure that system_update_8501() before the media update, so that the
    // new revision_default field is installed in the correct table.
    $dependencies['media_entity'][8201]['system'] = 8501;
  }
  return $dependencies;
}