Skip to content

Commit

Permalink
Closes #2685: Deprecate background_image_formatter module and add AZQ…
Browse files Browse the repository at this point in the history
…S deprecated modules warning to status report. (#2792)

Co-authored-by: Chris Green <[email protected]>
  • Loading branch information
joeparsons and trackleft authored Oct 6, 2023
1 parent 7151d68 commit 4b720a9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
47 changes: 47 additions & 0 deletions az_quickstart.install
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/

use Drupal\Core\Extension\MissingDependencyException;
use Drupal\Core\Link;
use Drupal\Core\Render\Markup;
use Drupal\Core\Url;
use Drupal\user\Entity\User;
use Drupal\shortcut\Entity\Shortcut;

Expand Down Expand Up @@ -56,6 +59,50 @@ function az_quickstart_install() {
}
}

/**
* Implements hook_requireents().
*/
function az_quickstart_requirements($phase) {
$requirements = [];
if ($phase === 'runtime') {
// Reset the extension lists.
/** @var \Drupal\Core\Extension\ModuleExtensionList $module_extension_list */
$module_extension_list = \Drupal::service('extension.list.module');
$module_extension_list->reset();

// Gather all deprecated modules that are enabled.
$azqs_deprecated_modules = [
'background_image_formatter',
'ckeditor',
'entity_browser',
];
$enabled_deprecated_modules = [];
$enabled_modules = \Drupal::moduleHandler()->getModuleList();
foreach ($enabled_modules as $module => $data) {
if (in_array($module, $azqs_deprecated_modules)) {
$enabled_deprecated_modules[$module] = $module_extension_list->getExtensionInfo($module)['name'];
}
}

// Warn if any deprecated modules are installed.
if (!empty($enabled_deprecated_modules)) {
foreach ($enabled_deprecated_modules as $deprecated_module => $name) {
$deprecated_modules_link_list[] = (string) Link::fromTextAndUrl($name, Url::fromUri('https://www.drupal.org/project/' . $deprecated_module))->toString();
}
$requirements['azqs_deprecated_modules'] = [
'title' => t('Quickstart deprecated modules enabled'),
'description' => t('These modules are no longer used by Arizona Quickstart and will be removed in a future release. These modules should be uninstalled or should be added to a site-specific composer.json file if they are still needed, or your site will not be able to be updated via Composer. Some action is required prior to updating to the next minor version.'),
'value' => t('Enabled Quickstart deprecated modules found: %module_list.', [
'%module_list' => Markup::create(implode(', ', $deprecated_modules_link_list)),
]),
'severity' => REQUIREMENT_WARNING,
];
}
}

return $requirements;
}

/**
* Implements hook_update_last_removed().
*/
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"drupal/antibot": "2.0.2",
"drupal/asset_injector": "2.19.0",
"drupal/auto_entitylabel": "3.0.0",
"drupal/background_image_formatter": "2.0.3",
"drupal/background_image_formatter": "*",
"drupal/better_exposed_filters": "6.0.3",
"drupal/blazy": "2.18.0",
"drupal/block_class": "2.0.11",
Expand Down

0 comments on commit 4b720a9

Please sign in to comment.