2

I am getting an error right after creating the tweet.libraries.yml file as per istructions given from a book about Drupal 8 theming. Can anyone help me fix this error?

The website encountered an unexpected error. Please try again later. Error: Cannot use assign-op operators with overloaded objects nor string offsets in Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 138 of core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php). Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension('tweet') (Line: 87) Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions('tweet') (Line: 66) Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss('tweet') (Line: 148) Drupal\Core\Cache\CacheCollector->get('tweet') (Line: 44) Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension('tweet') (Line: 58) Drupal\Core\Asset\LibraryDiscovery->getLibraryByName('tweet', 'bootstrap') (Line: 54) Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies(Array) (Line: 31) Drupal\Core\Asset\LibraryDependencyResolver->getLibrariesWithDependencies(Array) (Line: 104) Drupal\Core\Asset\AssetResolver->getLibrariesToLoad(Object) (Line: 116) Drupal\Core\Asset\AssetResolver->getCssAssets(Object, ) (Line: 291) Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 161) Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 45) Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object) (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.response', Object) (Line: 179) Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 161) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

This is the content of the tweet.info.yml file.

    name: tweet
    type: theme
    description: 'A twitter Bootstrap starter theme'
    core: 8.x
    base theme: false

    libraries:
      - tweet/bootstrap

This is the content of the tweet.libraries.yml file.

    bootstrap:
      version: 3.3.6
      css:
        theme:
          css/bootstrap.min.css: {}
          css/bootstrap-theme.min.css: {}
      js:
        js/bootstrap.min.js
      dependencies:
        - core/jquery
3
  • I reverted to previous commit via git and still had errors so I am going to reinstall drupal and start over. But if anyone knows how to fix this please tell me.
    – Olympus
    May 13, 2016 at 19:04
  • are u using base bootstrap theme ?? for ur theming ? May 13, 2016 at 19:07
  • No, not using the base bootstrap theme.
    – Olympus
    May 13, 2016 at 19:23

2 Answers 2

5

Change the tweet.info.yml file as follows.

name: 'tweet'
description: 'A twitter Bootstrap starter theme'
core: 8.x
type: theme
base theme: false

libraries:
  - 'tweet/bootstrap'

Put the following in the tweet.libraries.yml file.

bootstrap:
  version: 3.3.6
  css:
    theme:
      css/bootstrap.min.css: {}
      css/bootstrap-theme.min.css: {}
  js:
    js/bootstrap.min.js: {}
  dependencies:
    - core/jquery

Also, be sure you have a tweet.theme file in the same directory. This file is necessary for Drupal to recognize the directory contains a theme.

0
1

I needed a tweet.theme file. I grabbed it from the data files and pasted it into the directory. The book doesn't say to add a .theme file in the beginning of the corresponding chapter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.