This forum is for assistance with theme development.

Implement module features though theme

We are working on a website - we want to provide the theme(front-end UI) also want to implement some backend features with theme only. Is it possible ?

Use case: We are building a theme for a Critical Website. We want to create custom content type for our Website project. This can be implemented easily through Module. But we want to implement this only thgouh the theme. 

Is the above scenario possible. 

Along with the above requirement - we are looking for to create(implement) module features only through theme(is it possible). 

How to exclude form fields from a form template

I have built a basic entity in d8 using drupal console. I am then using a hook_form_alter to add some additional front-end fields to the form. These fields aren't functional on the back-end, but do some front-end stuff. 

Either way, I then made a hook_preprocess_form in my theme like this:

lms_preprocess_form(array &$variables) {

$variables['form'] = $variables['element'];

}

and I have a suggestions_form_alter() like this:

Move left sidebar below main contents on narrow display

I need to have a left sidebar with navigation, but I would also like that sidebar to sit below the main content div in the html output, so that one will not have to scroll past the entire menu for every single page view. How would I go about to do this? 

How to add node templates for content types in Drupal 9

I'm using bootstrap theme and my drupal core is 9.0.8.

My sub-theme name is "metiti" and my content type machine name is "article_type".

When a file is added "node--article-type.html.twig" it does not work correctly.

I wrote the below code into metiti.theme file and cleared the cache but it still does not work. what I'm doing wrong?

How to create template suggestion for image like IMAGE--BLOCK-TYPE or IMAGE--FIELD-TYPE

I'm struggling to make template suggestions like IMAGE--BLOCK-TYPE or IMAGE--FIELD-TYPE. I have three different block types(image1, image2, image3) with one image field(field_image_1, field_image_2 and field_image_3). And I don't know how to get suggestion like

image--block_image1.html.twig

image--block_image2.html.twig

image--block_image3.html.twig

or

image--field_image_1.html.twig

image--field_image_2.html.twig

image--field_image_3.html.twig

Is there any way to pass variable between two hooks

access custom field in node template from field template

I have a node template, node--newsletter.html.twig that has access to a custom variable field_download_link .  its a boolean and I can access it in the template via {{content.field_download_link[0]}}

the node template calls a field template via {{ content.field_nl_articles }}

from within field-articles.html.twig I would like to reference content.field_download_link from node--newsletter.html.twig (or pass the variable from the node template to the field template...either way I dont care, just need to see the value in the field template)

Pages

Subscribe with RSS Subscribe to RSS - Theme development