Skip to content
Snippets Groups Projects

Issue #2875374 by l0ke: Use Libraries to locate plugin

3 files
+ 46
0
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 13
0
@@ -13,7 +13,20 @@ function fakeobjects_requirements($phase) {
if ($phase == 'install' || $phase == 'runtime') {
$plugin_detected = file_exists(DRUPAL_ROOT . '/libraries/fakeobjects/plugin.js');
if (\Drupal::moduleHandler()->moduleExists('libraries')) {
$path = libraries_get_path('fakeobjects') . '/plugin.js';
}
// Is the plugin found in the root libraries path.
$plugin_detected = file_exists($path);
// If plugin is not found, then look in the current profile libraries path.
if (!$plugin_detected) {
$profile_path = drupal_get_path('profile', \Drupal::installProfile());
$profile_path .= '/libraries/fakeobjects/plugin.js';
// Is the library found in the current profile libraries path.
$plugin_detected = file_exists($profile_path);
}
if ($plugin_detected) {
$requirements['fakeobjects'] = [
'title' => t('FakeObjects'),
Loading