Skip to content

Commit

Permalink
Merge branch 'feat/harden-internal-token' of github.com:quantcdn/drup…
Browse files Browse the repository at this point in the history
…al into feat/harden-internal-token
  • Loading branch information
stooit committed Nov 1, 2023
2 parents 2bca4a7 + aa2191e commit 912ae09
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion quant.install
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function quant_update_9004(&$sandbox) {
}

/**
* Disables draft revisions if workbench moderation is in use.
* Disables draft content handling if Workbench Moderation is installed.
*/
function quant_update_9005(&$sandbox) {
if (\Drupal::moduleHandler()->moduleExists('workbench_moderation')) {
Expand Down
34 changes: 34 additions & 0 deletions quant.module
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,37 @@ function quant_special_pages() {
$item->send();
}
}

/**
* Implements hook_modules_installed().
*/
function quant_modules_installed($modules) {
if (in_array('workbench_moderation', $modules)) {
$config = \Drupal::configFactory()->getEditable('quant.settings');
$disabled = $config->get('disable_content_drafts');
// Only disable if not already disabled.
if (!$disabled) {
$config->set('disable_content_drafts', 1);
$config->save();
$message = 'Quant draft content handling has been disabled because the Workbench Moderation module has been installed.';
\Drupal::messenger()->addMessage(t($message));
\Drupal::logger('quant')->notice($message);
}
}
}

/**
* Implements hook_modules_uninstalled().
*/
function quant_modules_uninstalled($modules) {
if (in_array('workbench_moderation', $modules)) {
$config = \Drupal::configFactory()->getEditable('quant.settings');
$disabled = $config->get('disable_content_drafts');
// Only show message if disabled.
if ($disabled) {
$message = 'Quant draft content handling can be enabled now that the Workbench Moderation module has been uninstalled.';
\Drupal::messenger()->addMessage(t($message));
\Drupal::logger('quant')->notice($message);
}
}
}

0 comments on commit 912ae09

Please sign in to comment.