Linked Questions

5 votes
3 answers
5k 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 ...
usernameabc's user avatar
  • 2,686
3 votes
1 answer
5k 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 ...
clestcruz's user avatar
  • 239
2 votes
2 answers
4k 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 ...
William Turrell's user avatar
4 votes
1 answer
1k 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 ...
thomas's user avatar
  • 169
2 votes
1 answer
2k views

How can I get the customer name in an order confirmation e-mail?

How can I get the customer name from the billing information variable in the commerce-order-receipt.twig.html template file used in the order confirmation e-mail?
3 votes
1 answer
1k 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 {{ ...
Xavier's user avatar
  • 33
2 votes
1 answer
801 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?
rroose's user avatar
  • 360
0 votes
2 answers
702 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->...
sea26.2's user avatar
  • 1,004
1 vote
1 answer
993 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 ...
jbreslow's user avatar
0 votes
1 answer
328 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, ...
user avatar
0 votes
1 answer
125 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 : ...
Derek C.'s user avatar
  • 195