Drupal 8 : getting the nid of a node if a specific field value

Hi There,

The documentation is a little vague here and searching the class stack is not enlightening. Right now I'm using entityQuery as entityFieldQuery is deprecated in Drupal 8 e.g.

$query = \Drupal::entityQuery('node')
->condition('type', '{type-name}')
->condition("{field-name}.value", $ref);
$nids = $query->execute();

but I get no results.

I also tried a suggestion from another source for:

->condition("$this->{field-name}.value", $ref);

Using custom profile field in translations

Hey,

I want to use a custom profile field in translations of a string shown in articles. I can use tokens like @username there but how can I use the content of the custom profile field? I wish to use a real name field rather than an username field in articles as information about article's author.
Additionally I would like to know how I can change the date format in articles. I can use @date but not @date:medium?

Thanks for your help!

How to use a custom Twig template to render "Add new comment form"?

Hi,

I want to use a custom Twig template to render the "Add new comment" form.

However, this form is built with a LazyBuilder which I think do not allow me to suggest a new template.

I don't manage to tell Drupal to use my custom twig file to render the form.

In a form_alter, I dump the $form['#theme'] to see which suggestions are available by default. Here's the result:

Question re: hook_views_post_render()

Working on a module in which I'm trying to utilize this hook. According to the API docs, the arguments to this hook are:

\Drupal\views\ViewExecutable $view: The view object about to be processed.

string $output: A flat string with the rendered output of the view.

\Drupal\views\Plugin\views\cache\CachePluginBase $cache: The cache settings.

However, the second argument ($output), does not in fact, come in as a "flat string". It comes in as an array. Also, shouldn't that be "&$output", instead of "$output"?

D8 How to get rid of homepage field on comment for anonymous user

I'm a beginner with D8 but wrote own modules in D7. It is therefore possible that I miss some understanding to get easily what I need. All hints to help me step ahead are appreciated.

When I add a comment field to a node entity I have the possibility to configure for anonymous users between the following options:

See CommentItem.php

Language switcher block in Drupal 8

I have a two language Drupal 8 site, en, sv and have enabled the language switcher block. The block show up on all single pages but it do not showing if I have a view list. The view appears in the selected language, but the Language Switcher Block do not show.

Hope someone can give me some help on this.

/Christer

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x