Loading charts.module +14 −2 Original line number Diff line number Diff line Loading @@ -207,15 +207,27 @@ function _charts_library_info_alter_recursive(array &$library, array $cdn) { */ function _charts_library_check_source_exists(string $source) { $source = rtrim($source, '/'); // @todo refactor the if statement below when dropping support for drupal 8. if (version_compare(\Drupal::VERSION, '9.0', '<')) { $app_root = \Drupal::service('app.root'); $site_path = \Drupal::service('site.path'); } else { $container = \Drupal::getContainer(); $app_root = $container->getParameter('app.root'); $site_path = $container->getParameter('site.path'); } // The following logic is taken from libraries_get_libraries() $search_dir = []; $search_dir[] = \Drupal::service('app.root'); $search_dir[] = $app_root; // Similar to 'modules' and 'themes' directories inside an installation // profile, installation profiles may want to place libraries into a // 'libraries' directory. $search_dir[] = 'profiles/' . \Drupal::installProfile(); // Also search sites/<domain>/*. $search_dir[] = \Drupal::service('site.path'); $search_dir[] = $site_path; foreach ($search_dir as $dir) { if (file_exists($dir . $source) || file_exists($dir . $source)) { Loading Loading
charts.module +14 −2 Original line number Diff line number Diff line Loading @@ -207,15 +207,27 @@ function _charts_library_info_alter_recursive(array &$library, array $cdn) { */ function _charts_library_check_source_exists(string $source) { $source = rtrim($source, '/'); // @todo refactor the if statement below when dropping support for drupal 8. if (version_compare(\Drupal::VERSION, '9.0', '<')) { $app_root = \Drupal::service('app.root'); $site_path = \Drupal::service('site.path'); } else { $container = \Drupal::getContainer(); $app_root = $container->getParameter('app.root'); $site_path = $container->getParameter('site.path'); } // The following logic is taken from libraries_get_libraries() $search_dir = []; $search_dir[] = \Drupal::service('app.root'); $search_dir[] = $app_root; // Similar to 'modules' and 'themes' directories inside an installation // profile, installation profiles may want to place libraries into a // 'libraries' directory. $search_dir[] = 'profiles/' . \Drupal::installProfile(); // Also search sites/<domain>/*. $search_dir[] = \Drupal::service('site.path'); $search_dir[] = $site_path; foreach ($search_dir as $dir) { if (file_exists($dir . $source) || file_exists($dir . $source)) { Loading