I 'd be grateful if someone could help with this..
I have a webform, let's call it input form, which, when submitted, triggers an external application to run on my server. That application uses some of the submission data (reading from webform_submission_data table) and after some time produces an output in the form of XML.
Now, through the use of feeds module, I read that XML data and produce a node, of a certain content type, let's call it results CT ..
I have a twig template for the results content type, and output is nicely presented to the user.
So far, so good.
Now my problem is this. I need to show both input and output in the same results page.
I tried to use Webform Content Creator module and indeed I have nodes with submission data - let's call this input data CT.
However, at the time of input form submission, I don't have the results yet. And I want to link the two together, obviously upon the creation of the results node.
I tried to reference each content type, using Corresponding Entity References so that when a results node is created (automatically through feeds) it would link to the corresponding input data CT. I thought that if I can achieve that connection, then I would be able to access the 'input' data through the results page template.
However, I can't make this connection to work - the 'entity reference' field that I use on the results CT, wants an 'entity ID' - and I can't find that. Remember that nodes are created automatically, I don't have a user creating nodes via a select form or autocomplete text field.
I am trying to figure out how to do this through the sid (submission id) which seems to be a unique key for every submission, and I have this on both my content types .. So ideally I would like to use the sid that I have on my results template, and use that to get the submission data I need.
(obviously) I am not very familiar with the drupal API - I am however comfortable with twig .. I don't know if (and how) I could pass that information through a pre-process function to be available in the results template.. Is there a simpler way to do it?
Could I link two content types based on a custom field (say a unique number, like sid ??).
Ideally, in a few words, what I want is this:
I have a CT (results) with various fields, one of which is sid. That sid corresponds to a (unique) submission id. How can I access data relevant to that submission id from within the results twig template? So I can then present both input (submission data) and output (results) in the same page.
PS - Perhaps one solution would be to refactor the whole logic, and use one CT for both input/output. Insert some data upon form submission, and then, when results are ready, edit (i.e. fill-in) the rest of the 'output' fields via feeds. Then all data are in one CT. However I would rather avoid this as it's quite a big change .. Shamefully enough, I might just re-enter input data through the XML again - it wouldn't be a problem - but it's a really crap solution ..
I 'd be really grateful if someone could help .. I hope I explained the whole situation adequately enough ..