Created on 1 August 2023, over 1 year ago
Updated 3 October 2023, about 1 year ago

Problem/Motivation

Followed
https://www.drupal.org/docs/8/themes/barrio-bootstrap-4-drupal-8-theme/c... and created a subtheme called "mysubtheme"

I get the below error in my Drupal 9.5.10 dashboard:

****

Warning: foreach() argument must be of type array|object, string given in Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 198 of core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php).
Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension('mysubtheme') (Line: 87)
Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions('mysubtheme') (Line: 66)
Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss('mysubtheme') (Line: 149)
Drupal\Core\Cache\CacheCollector->get('mysubtheme') (Line: 44)
Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension('mysubtheme') (Line: 58)
Drupal\Core\Asset\LibraryDiscovery->getLibraryByName('mysubtheme', 'bootstrap_cdn') (Line: 68)
Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies(Array) (Line: 41)
Drupal\Core\Asset\LibraryDependencyResolver->getLibrariesWithDependencies(Array) (Line: 104)
Drupal\Core\Asset\AssetResolver->getLibrariesToLoad(Object) (Line: 116)
Drupal\Core\Asset\AssetResolver->getCssAssets(Object, ) (Line: 311)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 157)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 94)
Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object)
call_user_func(Array, Object, 'kernel.response', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 202)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 190)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: foreach() argument must be of type array|object, string given in Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 198 of core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php).
Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension('mysubtheme') (Line: 87)
Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions('mysubtheme') (Line: 66)
Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss('mysubtheme') (Line: 149)
Drupal\Core\Cache\CacheCollector->get('mysubtheme') (Line: 44)
Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension('mysubtheme') (Line: 58)
Drupal\Core\Asset\LibraryDiscovery->getLibraryByName('mysubtheme', 'bootstrap_cdn') (Line: 68)
Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies(Array) (Line: 41)
Drupal\Core\Asset\LibraryDependencyResolver->getLibrariesWithDependencies(Array) (Line: 104)
Drupal\Core\Asset\AssetResolver->getLibrariesToLoad(Object) (Line: 116)
Drupal\Core\Asset\AssetResolver->getCssAssets(Object, ) (Line: 311)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 157)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 94)
Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object)
call_user_func(Array, Object, 'kernel.response', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 202)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 190)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: foreach() argument must be of type array|object, string given in Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 198 of core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php).
Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension('mysubtheme') (Line: 87)
Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions('mysubtheme') (Line: 66)
Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss('mysubtheme') (Line: 149)
Drupal\Core\Cache\CacheCollector->get('mysubtheme') (Line: 44)
Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension('mysubtheme') (Line: 58)
Drupal\Core\Asset\LibraryDiscovery->getLibraryByName('mysubtheme', 'bootstrap_cdn') (Line: 68)
Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies(Array) (Line: 41)
Drupal\Core\Asset\LibraryDependencyResolver->getLibrariesWithDependencies(Array) (Line: 104)
Drupal\Core\Asset\AssetResolver->getLibrariesToLoad(Object) (Line: 116)
Drupal\Core\Asset\AssetResolver->getCssAssets(Object, ) (Line: 311)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 157)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 94)
Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object)
call_user_func(Array, Object, 'kernel.response', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 202)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 190)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

****

Steps to reproduce

Wondering how to troubleshoot this.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Fixed

Version

5.5

Component

Code

Created by

🇺🇸United States hcanning

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hcanning
  • Status changed to Postponed: needs info over 1 year ago
  • 🇵🇪Peru hatuhay Lima

    The issue looks related with how the bootstrap library is loaded on your subtheme

  • 🇺🇸United States hcanning

    Hi,
    The bootstrap yml files in question are:

    mysubtheme.info.yml

    libraries:
      - mysubtheme/bootstrap_cdn
      - mysubtheme/global-styling

    mysubtheme.libraries.yml

    bootstrap:
      js:
        /libraries/bootstrap/dist/js/bootstrap.min.js: {}
      css:
        component:
          /libraries/bootstrap/dist/css/bootstrap.min.css: {}
      dependencies:
        - core/popperjs
    bootstrap_cdn:
      js:
        //cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js: { type: external, minified: true }
      css:
        component:
          //cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css: { type: external, minified: true }

    Thanks

  • 🇮🇳India ravi kant Jaipur

    @hcanning
    I just tried creating a new theme and did not get this type of errors.
    Do you still need support, or is it solved now?

  • Assigned to hcanning
  • Status changed to Fixed about 1 year ago
  • 🇺🇸United States hcanning

    Incorrect syntax in yml. User error.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024