You are here

function preview_link_update_8203 in Preview Link 2.x

Same name and namespace in other branches
  1. 2.0.x preview_link.install \preview_link_update_8203()

Install Dynamic Entity Reference.

File

./preview_link.install, line 54
Install file.

Code

function preview_link_update_8203() : TranslatableMarkup {
  $module = 'dynamic_entity_reference';
  if (\Drupal::moduleHandler()
    ->moduleExists($module)) {
    return \t('Dynamic Entity Reference is already installed!');
  }

  /** @var \Drupal\Core\Extension\ModuleInstallerInterface $moduleInstaller */
  $moduleInstaller = \Drupal::service('module_installer');
  $installed = $moduleInstaller
    ->install([
    $module,
  ]);
  if ($installed) {
    return \t('Dynamic Entity Reference installed successfully');
  }
  else {
    throw new UpdateException('Dynamic Entity Reference failed to install');
  }
}