Skip to content
Snippets Groups Projects

fixed

Closed chetan requested to merge issue/splitting-3399960:3399960-warning-on-install into 1.0.x
1 file
+ 9
3
Compare changes
  • Side-by-side
  • Inline
+ 9
3
@@ -17,12 +17,18 @@ function splitting_requirements($phase) {
/** @var Drupal\Core\Asset\LibraryDiscovery $library_discovery */
$library_discovery = \Drupal::service('library.discovery');
$library_splitting = $library_discovery->getLibraryByName('splitting', 'splitting.js');
$library_exists_js = file_exists(DRUPAL_ROOT . '/' . $library_splitting['js'][0]['data']);
// Check if $library_splitting is an array before accessing its elements.
if (is_array($library_splitting) && isset($library_splitting['js'][0]['data'])) {
$library_exists_js = file_exists(DRUPAL_ROOT . '/' . $library_splitting['js'][0]['data']);
} else {
$library_exists_js = false;
}
switch ($phase) {
case 'install':
if (!$library_exists_js) {
$description = t('The Splitting.js library is missing. Please <a href=":downloadUrl" rel="external" target="_blank">Download the library</a> and and extract to /libraries/splitting directory.', [
$description = t('The Splitting.js library is missing. Please <a href=":downloadUrl" rel="external" target="_blank">Download the library</a> and extract it to the /libraries/splitting directory.', [
':downloadUrl' => SPLITTING_DOWNLOAD_URL,
]);
$requirements['splitting']['description'] = $description;
@@ -31,8 +37,8 @@ function splitting_requirements($phase) {
\Drupal::messenger()->addWarning($description);
}
break;
case 'runtime':
// Show the status of the library in the status report section.
if ($library_exists_js) {
Loading