This forum is for assistance with theme development.

How can I load an image by an uri in preprocess image?

I wrote a custom template with a customtemplate_preprocess_image function.

In this function I have only $variables['uri'] at my disposal to load the same image but with a different image style. The uri is of this format: '/sites/default/files/styles/image_xs/public/2019-02/IMG_20181219_135712499_0.jpg?itok=1faUCioy'

If I now do this

How to create a switch that changes the content of the page ?

I have a drupal site 8 th I use Twig to customize my pages.

I created 2 blocks view :

 - drupal_view('message_activity_stream_timeline_public', 'block_1') }}
 - drupal_view('message_activity_stream_timeline_private', 'block_1') }}

On my homepage, I want to put a switch that goes from block_1 to block_2 and vice versa.

When the switch is on the position PUBLIC it must display the block drupal_view('message_activity_stream_timeline_public', 'block_1') }}.

How do I check if URL contains certain words

I want to show a custom content if current URL contain certain words. So far, I'm able to achieve this with the code below (works perfectly), if the path contain the word 'cart'. I want to be able to check for other words like 'blog', 'event' and 'news'. How do I go about this.

How to count the number of class ?

On my page I have several blocks, some have a class task-success and others have the class task-alert.

How to add a class task-alert to the menu if the class task-danger is present in the page ?

I managed to do this with the JS code below. But the class is added to the menu link only if I am on the page (the page containing the task-danger class). If I change pages, the class is not added to the menu link.

When a visitor arrives on a page 403 how to put it back on this page after he has logged in ?

I have a site with Drupal 8. I am an anonymous user. I am visiting the page "Messaging" which is accessible only to the authenticated user. The page displays a code 403 with a block to connect me.

When I connect, I arrive on the homepage of the site.

I created a 403 custom page with a "Connect" button in a Twig file of my theme:

<a class="use-ajax btn btn-success btn-md" href="/user/login" data-dialog-type="modal">Se connecter</a>

How to make the user who logs on a 403 page, return to the current page?

Drupal 8 Bootstrap Theme Forum Styling

I'm using Drupal 8.6.9 with a Bootstrap sub theme and I've enabled a forum on my site. Unfortunately the forum page does not have any CSS

styling. Could someone provide me some guidance as to how I can improve the look of the forum page...?

Pages

Subscribe with RSS Subscribe to RSS - Theme development