You are here

function tmgmt_smartling_update_8003 in TMGMT Translator Smartling 8.2

Same name and namespace in other branches
  1. 8.4 tmgmt_smartling.install \tmgmt_smartling_update_8003()
  2. 8 tmgmt_smartling.install \tmgmt_smartling_update_8003()
  3. 8.3 tmgmt_smartling.install \tmgmt_smartling_update_8003()

Enable needed dependency.

File

./tmgmt_smartling.install, line 56
Update function for the tmgmt_smartling module.

Code

function tmgmt_smartling_update_8003() {

  // Check if dependency exists. Not enabled/disabled, but exists or not.
  $dependency_exists = module_load_include('module', 'tmgmt_extension_suit');
  if (!$dependency_exists) {
    throw new UpdateException('Unresolved dependency: tmgmt_extension_suit (missing).');
  }

  // Enable module if it's not enabled yet.
  if (!Drupal::service('module_handler')
    ->moduleExists('tmgmt_extension_suit')) {
    Drupal::service('module_installer')
      ->install([
      'tmgmt_extension_suit',
    ]);
  }
}