Deployment failure in Drupal

 In case, a config import error is coming because the new module is not installed then we can do the following

function somemodule_update_10001() {

  if (!\Drupal::service('module_handler')->moduleExists('new_module')) {

    \Drupal::service('module_installer')->install(['new_module']);

  }

}

Comments

Popular posts from this blog

Programatically create layout builder section in Drupal

Code quality analysis of Drupal. Can I use Sonar?

Set up Drupal7 to Drupal8 migration in simple steps (using Drush)