Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Version tags should be used for questions that apply to a version only, not to merely say what version a site is using.
7
votes
2
answers
4k
views
How to show an image in an image style
I'm creating a custom twig for my node 1, as node--1.twig.html.
In this I'm showing the image uploaded in the node as
<div class="diversity-image">
{{ set image = content.field_main_image|merg …
6
votes
2
answers
2k
views
How to set the default theme programmatically
I've tried to set a theme as default theme in drupal 8 using the following code
> $config = \Drupal::configFactory()->getEditable('system.theme');
> $config->set('default', 'test_theme')->save(); …
6
votes
1
answer
23k
views
How do I call a controller function in a module?
I am trying to access a static method of a controller class from a module, but my code doesn't work.
This is the controller class.
namespace Drupal\content_statistics\Controller;
use Drupal\Core\Co …
3
votes
1
answer
2k
views
Get the alt for the image on views twig
I've got an image field, in which I'm showing the image using url by setting the relationship for that field on 'Advanced' tab to get the url of the field.
I'm getting the url of the field as
{% s …
2
votes
0
answers
248
views
Where are the po files and how to translate strings without using the UI?
I'm using Drupal 8 built-in translation. I've English and Spanish in my website. I've translated the website to Spanish as well. But I don't see any po files for the translation script. …
2
votes
1
answer
9k
views
How to theme menus in a custom twig
I've fetched the main menu for the website using the code below.
public function build() {
$menu_name = 'main';
$menu_tree = \Drupal::menuTree();
$parameters = $menu_tree->getCurrentRout …
2
votes
1
answer
9k
views
How to render an array to twig
I've a block with values in the following array structure.
$block['tag'][] = $term;
$block['image'][] = $url;
$block['title'][] = $title;
$block['description'][] = $de …
2
votes
2
answers
3k
views
How to include menu item in breadcrumb
I've this breadcrumb I've created, where I would like to show it as
Home > Main menu > Sub menu
Where sub menu is connected to a node. So when a user click on node, it must show the breadcrumb of th …
1
vote
0
answers
366
views
Theme hook suggestion not working
I've a node, I'm trying to theme the same with the title of the node. I've written the code for it. Now when looking the source code, the twig file is showing also, but it is directly taking node twig …
1
vote
Drupal 8 blocks content is not being translated
You need to navigate to admin/config/regional/translate. Try to search for "Test NL" in the input field. It will give you the string on the left side along with a text-field to the right. Enter the tr …
1
vote
0
answers
53
views
How to theme views fields seperately [duplicate]
I'm theming a view which name is testimonials, I would like to make the view block a slider, so I'm creating the twig file as views-view-unformatted--testimonials.html.twig.
When I inspect I'm getti …
1
vote
3
answers
1k
views
How do I add the noscript tag?
I've a drupal 8 website, where in every page, I would like to add a noscript tag for every script tag. In drupal 8, in html.html.twig, I saw the scripts variable in missing. … So how do I do that in Drupal 8? …
1
vote
2
answers
5k
views
Get the parent menu of the node
I've a node, which is linked to a sub menu in the main navigation. I would like to get the url and title for the parent menu of the sub menu selected.
I've used it, but it is not working.
I'm trying …
1
vote
3
answers
1k
views
How to unset the title of a custom form field
I'm trying to unset the label of a custom form called email. In which the value is in the #title key.
I've tried {{ value|without('title', 'description', 'email.#title') }}
But it is not working
0
votes
2
answers
388
views
How do I format a field in views?
I have an FAQ page, where in the title it has some html tags, I would like to show the title in the views. When the view is displayed, it is showing html tags as well. How can I get the html processed …