0

I have a view displaying a list of nodes. Each node has a webform submission related, and the sid is stored in one field "field_sid".

I'd like to be able to access the submission data in the node view, using a relationship thanks to the sid field.

Is there a good and efficient way to do this ?

Thank you very much and sorry for my bad english

Edit : I tried the Sivani solution but unfortunately I wasn't able to link the "field_sid" from the node to the good submission ID. How to do this ?

0

You have to use hook_views_data_alter for node and webform submissions relation in view.

function mymodule_views_data_alter(&$data) {
  if (isset($data['webform_submitted_data']['data_numeric'])) {
    if (!isset($data['webform_submitted_data']['data_numeric']['relationship'])) {
      $data['webform_submitted_data']['data_numeric']['relationship'] = array (
        'handler' => 'views_handler_relationship',
        'base' => 'node',
        'base field' => 'nid',
        'label' => t('Referred node'),
      );
    }
  }
}
  • Hello, and thank you. I tried it but unfortunately I wasn't able to link the "field_sid" from the node to the good submission ID. Can you help me again? – Kamzz May 23 '18 at 15:24

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.