This forum is for assistance with theme development.

Attach custom javascript dynamically generated on a theme page.

In my case I want to write some javascript code inside the paragraph-something.hmtl.twig taking elements from the theme variables and then putting this javascript attached to the bottom of the page. Something like: 

{{ attach_library('my/code') }}

but being able to write the code dynamically and not link to a js file pre-comp.

It's possible?

How to display the thumbnail of a YouTube video in TWIG ?

I created a template for the "Remote video" media type.

I want to display in this template the url of the thumbnail of my video.

I tested this code {{ media.field_thumbnail.value }} but it doesn't work.

The problem is that the thumbnail field is a false field. It does not appear in "Manage fields".

How to display the thumbnail of a YouTube video in TWIG ?

media--remote-video--default.html.twig :

No Way to Select(css) Parent of Active Menu (Superfish)

I need to change the background of the parent li element for a submenu anchor element with the is-active" class.  How do I add a "current" class to the parent li element? (that's one way to do it)

I don't think there's anyway to do it just using css and the existing classes that are available.

Why doesn't the Barrio theme (Bootstrap 5) support drop down menus? That's why I'm using Superfish. Bootstrap 4 supported drop down menus.

themes not working for anonymous users

Hi, I tried installing two different themes (Creative Responsive Theme - https://www.drupal.org/project/creative_responsive_theme and Professional Responsive Theme - https://www.drupal.org/project/professional_responsive_theme). When I apply each of them, they work for me when I'm logged in. However, when I try to access the website while logged out, I get a "The website encountered an unexpected error.

NO RESULTS BEHAVIOR doesn't render on a grouped field table (view)

Hello, i have a problem with my drupal 8 page. 

I have created a view with:

  • Thumbnail
  • Title of the object
  • Media type
  • Year (taxonomy)
  • Link to download
  • Edit link for admin

This yields a table. With also 2 filters on Media type and Year. 

So now to my problem. 

When i use it as a plain table (no grouping used) i can use NO RESULT BEHAVIOR and when i filter on a media type which the table doesn't have or a year that isnt added i get a response. 

SOLVED -- Classy-based custom theme not working

Hi, I'm attempting to learn Drupal through the book Drupal 8: Enterprise Web Development by Nick Abbott. In Module 2 chapter 5, the book has us create and install a custom theme based on Classy. I copied and pasted the code directly from the book; however, when I did so and then set the custom theme as default, I did not see anything other than bare HTML without any CSS or JavaScript. 

The mytheme.info.yml file is:

Pages

Subscribe with RSS Subscribe to RSS - Theme development