This forum is for assistance with theme development.

Adding CSS and JS to my theme

Hello,

I created a template in which I am using a UI kit from Creative Tim. Now I am trying to turn this template into a Drupal theme, but I am having trouble with getting all the JS to work. I am getting the following errors in my console: https://imgur.com/7XFfOcC

Below is a structure of the CSS and JS files from my template, and then how I am including them in my theme.

In my head (CSS files):

Render TWIG when adding a custom block to panels

Hi,

I created a simple custom block out of "Basic block" and called it "testblock1".

I created a TWIG file called "block--testblock1.html.twig" with a div and background-color:yellow;

When I add the custom block "testblock1" using the block layout, I see the content of "testblock1" with a yellow background (which is great!).

But, when I add "testblock1" from panels->content->add new block, I see the content of "testblock1" but NOT the HTML of the TWIG file with the yellow background.

Theme randomly uses system module templates instead of my own

Hello all!

I have an issue that I don't quite understand.

Sometimes, very very randomly (like maybe once or twice a week), the theme from my production site switch by itself from my theme to the templates used by the system module. But not all of the templates : only the html.tpl.php and the page.tpl.php. The node.tpl.pph for example would be the one from my theme. And it only takes a cache flush to make it back to normal.

Did anyone have this problem at some point? Does someone know when the system module template files are used?

Thanks!

Views won't display field content with formatted text and formatter set to default

I'm in the process of migrating a site from Drupal 7 to Drupal 8. I've created two views that render text fields. If the text field is plain text, and the formatter option is set to plain text it works fine. If the text field is formatted and the formatter in views is set to Default or Trimmed—those are the only two options—the content won't render.

Any ideas?

Thanks,

template.php vs mytheme.theme

Hello,

I'm in the process of migrating a site from drupal 7 to drupal 8 and I'm having a problem with where or how to implement functions I had in my template.php file.

For example in drupal 7 I have this function in my template.php file:

function some_function($var1, $var2){
print $var1 . $var2;
}

I call the function from a template file like this:

<?php some_function('Hello', 'World'); ?>

How and where would I implement something similar in Drupal 8.

Small CSS corrections

I have made a sub-theme of Bootstrap 3 and want to alter some small CSS default settings. I need help for that. I make use of the Asset Injector module.

- I have several jpg-files. How can I make a header carousel of them?
- If I want to make the height or width bigger from the header, how can I do this?

I am convinced this is just a small piece of code.
But how can I find it out?

Pages

Subscribe with RSS Subscribe to RSS - Theme development