1

In Drupal 8, I have a webform field attached to a node with the Link to form formatter enabled.

Can I add the ID of that node in the Link custom attributes (YAML) textarea to display a block view of some node fields?

My goal is to be able to use a contextual filter on the block view to display the node information like title and some other fields around the form

screenshot

  • What's your end goal? I'm not quite following. – Matt Aug 13 '18 at 21:01
  • I have a just my question see above – purencool Aug 13 '18 at 21:56
1

I don't think webform link field can be used to accomplish this as the purpose of Link custom attributes (YAML) is for HTML TAG attributes like

target: _blank

You can use field_token_value to create a field on the node that has tokens as input. Install and enable the module and then add a token field.

enter image description here

The value of this field would be an HTML link with query parameters added (nodetitle in this example) you can browser for all available tokens under field value.

enter image description here

Then on the webform side you have to enable query parameter to populate fields by going to the settings of the webform > form > form behaviours > prepopulate > Allow all elements to be populated using query string parameters.

enter image description here

And then on the field to display the query parameter include the appropriate token. Here adding the nodetitle to the subject field default value.

enter image description here

For token field to be populated a node needs to be saved.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.