Linked Questions

3
votes
3answers
3k views

How to get height and width of image style?

We have a custom module mymodule where we call mymodule_tokens so that we can assign custom token values from the current node. These custom tokens are used to insert values in the Article's MetaTag ...
3
votes
1answer
4k views

How to print the file description to my twig template?

I'm trying to figure how I can obtain or print the file description that is uploaded on my node and display on my twig template So far I have tried {{ file.entity.label }} which only prints the name ...
1
vote
2answers
3k views

hook_field_widget_form_alter - modify specified field only

I'd like to use a hook to modify a widget, but only for a named field. Use case: a form has an entity reference to another content type, using an options_buttons widget (a list of available courses ...
4
votes
1answer
668 views

How to automatically populate a field with a value part of another field

I will try to be as specific as possible. I have a required text plain field in a content type, say 'field_A'. This will have values of minimum 2 words, maximum 5 words. Words will be separated by ...
2
votes
1answer
654 views

Show comment author e-mail in comment.html.twig

Anonymous users can leave their e-mail when posting a comment but how can I display this e-mail as a plain text value in the comment.html.twig?
2
votes
1answer
1k views

How to get the customer name in Commerce order confirmation e-mail?

How can I get the customer name from the billing information variable in the commerce-order-receipt.twig.html template of the Drupal 8 Commerce order confirmation e-mail?
3
votes
1answer
715 views

How to get node url/address from entity reference (content type)?

Is there a way to fetch or print the node url/address from a entity reference to my twig template. I have already tried {{ related_links.entity.uri }}, {{ related_links.entity.url }} or {{ ...
0
votes
2answers
72 views

Given a taxonomy term id, how do we get the value of other fields; specifically the machine_id?

A good example of getting the children is posted How to get fields... I need the machine_id of the parent (or target) Code below fetches the name; $product_name_id = $product_name_reference->...
0
votes
1answer
53 views

Problems with altering a form [duplicate]

I'm wanting to alter the commerce cart page form. By using var_dump($form_id) or chrome inspect I can see the id is id="views-form-commerce-cart-form-orange-default-42". If I write my hook as : ...
0
votes
1answer
66 views

Debugging the result property in a ViewExecutable

I need to debug the $result property of the ViewExecutable object passed to hook_views_post_execute but for what ever reason, Drupal can't handle it. $view->result is an array of type ResultRow, ...
1
vote
1answer
58 views

Get list of preprocess block variables

How can I display a list of preprocess block variables so I can conditionally include a library? Using the 'plugin_id' doesn't seem to work and when I echo all of the variables all I see is a blank ...