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

Conversation

@kdruckman
Copy link
Contributor

No description provided.

Copy link
Collaborator

@phenaproxima phenaproxima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely what I was imagining! Nice work!! In addition to these changes, can we also add drupal/libraries:^3.0 as an explicit dependency to Lightning's composer.json?

@phenaproxima phenaproxima changed the title Add a check for Libraries API module and give a warning to users. Add a check for Libraries API module and give a warning to users about the dependency being dropped Mar 5, 2020
@phenaproxima phenaproxima changed the title Add a check for Libraries API module and give a warning to users about the dependency being dropped Add a check for Libraries API module and warn users about the dependency being dropped Mar 5, 2020
@phenaproxima
Copy link
Collaborator

This looks pretty damn great! Since we've decided that Lightning Media will be the thing to deprecate and remove this dependency, let's close this PR and reconstitute it against Lightning Media 3.x.

$enabled_modules = \Drupal::service('extension.list.module')->getAllInstalledInfo();

foreach ($enabled_modules as $module => $info) {
foreach (['libraries:libraries', 'libraries'] as $needle) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove a level of nesting here by using array_intersect(), like so:

foreach ($enabled_modules as $module => $info) {
  if (array_intersect($info['dependencies'], ['libraries:libraries', 'libraries'])) {
    $libraries_dependencies[$module] = $info['name'];
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, much better, thanks!

}
}

if ($enabled_modules) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be if ($libraries_dependencies). :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh! Yes it should.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants