Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Add a check for Libraries API module and warn users about the dependency being dropped #671

Open
wants to merge 19 commits into
base: 8.x-4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion drupal-org-core.make
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ projects[drupal][download][tag] = 8.8.2
projects[drupal][patch][] = https://www.drupal.org/files/issues/2020-02-07/2869592-remove-update-warning-34.patch
projects[drupal][patch][] = https://www.drupal.org/files/issues/2019-11-05/1356276-531-8.8.x-4.patch
projects[drupal][patch][] = https://www.drupal.org/files/issues/2018-07-09/2914389-8-do-not-test.patch
projects[drupal][patch][] = https://www.drupal.org/files/issues/2019-11-27/2815221-125.patch
projects[drupal][patch][] = https://www.drupal.org/files/issues/2019-11-27/2815221-125.patch
28 changes: 28 additions & 0 deletions lightning.install
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,34 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\field\Entity\FieldConfig;
use Drupal\lightning_core\ConfigHelper as Config;

/**
* Alerts users of Libraries API dependencies.
*
* A future version of Lightning will remove Libraries API, so
* users must add that dependency to composer.json manually.
*/
kdruckman marked this conversation as resolved.
Show resolved Hide resolved
function lightning_requirements() {
$requirements = [];
$libraries_dependencies = [];
$enabled_modules = \Drupal::moduleHandler()->getModuleList();

foreach ($enabled_modules as $module => $data) {
kdruckman marked this conversation as resolved.
Show resolved Hide resolved
$info = \Drupal::service('extension.list.module')->getExtensionInfo($module);
if (in_array('drupal:libraries', $info['dependencies'])) {
kdruckman marked this conversation as resolved.
Show resolved Hide resolved
$libraries_dependencies[$module] = $info['name'];
}
}

if ($enabled_modules) {
$requirements['lightning_libraries'] = [
'title' => t('Libraries API dependencies'),
'value' => t('These modules require Libraries API: %module_list. Lightning will soon remove Libraries API as a dependency, so you must add that dependency to your composer.json manually.', ['%module_list' => implode(', ', $libraries_dependencies)]),
kdruckman marked this conversation as resolved.
Show resolved Hide resolved
'severity' => REQUIREMENT_WARNING,
];
}
return $requirements;
}

/**
* Makes updates to some basic config that ships with Lightning.
*
Expand Down