Browse Source

Add update hook to enable ctools in sites where it may not be.

... as it's now required.
pull/896/head
Adam Vessey 3 years ago
parent
commit
2c42a35556
No known key found for this signature in database
GPG Key ID: 89B39535BF6D0D39
  1. 30
      islandora.install

30
islandora.install

@ -5,6 +5,10 @@
* Install/update hook implementations.
*/
use Drupal\Core\Extension\ExtensionNameLengthException;
use Drupal\Core\Extension\MissingDependencyException;
use Drupal\Core\Utility\UpdateException;
/**
* Adds common namespaces to jsonld.settings.
*/
@ -174,3 +178,29 @@ function update_jsonld_included_namespaces() {
->warning("Could not find required jsonld.settings to add default RDF namespaces.");
}
}
/**
* Ensure that ctools is enabled.
*/
function islandora_update_8007() {
$module_handler = \Drupal::moduleHandler();
if ($module_handler->moduleExists('ctools')) {
return t('The "@module_name" module is already enabled.', [
'@module_name' => 'ctools',
]);
}
/** @var \Drupal\Core\Extension\ModuleInstallerInterface $installer */
$installer = \Drupal::service('module_installer');
try {
if ($installer->install(['ctools'], TRUE)) {
return t('The "@module_name" module was enabled successfully.', [
'@module_name' => 'ctools',
]);
}
}
catch (ExtensionNameLengthException | MissingDependencyException $e) {
throw new UpdateException('Failed; ensure that the ctools module is available in the Drupal installation.');
}
}

Loading…
Cancel
Save