1

I'm not sure how best to approach this problem and I'm hoping someone can point me in the right direction.

Quick summary of the setup of some nodes: Node A is the parent node. Node B is a child of Node A. Node B also houses/displays webforms. We have a "form" field in Node B where we can call existing webforms and Node B will then display the webform and any additional information (entered in Node B) to the user.

Now to the problem: The nodes are displayed via a carousel (using jQuery Cycle2). Editors add content (Node A) to the carousel using Entity Queue. The entity queue is tied to a view, which is set up to display the required fields from Node A in each "card". If a webform exists, and Node A references Node B with the webform, the webforms' scheduled date needs to display on that particular carousel card.

In my view, I have a contextual filter on the "Content: Webform Reference", but this only displays the webform date if Node B is entered in the Entity Queue. Since Node B will NEVER be used in the Entity Queue, I need to find a way to get to the webform schedule date from Node B when Node A is called.

Is it possible to do something like this within the view? Or would this require a custom plugin block?

5
  • Welcome to Drupal Answers :) The entity queue complicates things here - usually the trick to something like this is to set up the View as if it was going to display Node Bs, add a relationship to the parent (node A), and use the parent relationship for the display fields where required. The contextual filter would then apply to Node B instead of Node A types and it should work as needed. If adding Node Bs to the entity queue is an option, that might be the way to go. If not, you might have to think about writing a custom plugin for entity queue which can plug the gap
    – Clive
    Commented Jun 9, 2021 at 19:03
  • Can you clarify your structure, how exactly is the Webform referenced in B? Entity Reference field? If so, then there are two "bridges" you need to cross. Usually to bring Node B info into the View you add the Content: BtoA ER, default value URL... You have another connection to make, and that is from B to Webform. Maybe at this point you create a Display Mode for your Webform that shows only the Schedule date, and use that mode in Views on the Webform ER field. The alternative route might be to use 2 backwards Relationships but I've never tried that (one for BtoA, other for BtoWebform).
    – prkos
    Commented Jun 9, 2021 at 22:15
  • Thanks for the feedback. Before getting into custom plugins, I think I'll rewrite the view to see about dislpaying Node B but add the relationship to Node A and then pull all required fields. To answer prkos' ques: the webform is added as a webform field (field type webform) and the form settings fields (scheduled/open/close date fields) are included as well.
    – calfie
    Commented Jun 10, 2021 at 15:55
  • As you've found a solution, you should actually answer your own question below. Then this question will show up in searches as one with a solution, giving it a higher priority. Welcome to Drupal Answers!
    – Jaypan
    Commented Jun 10, 2021 at 17:45
  • Thanks for the heads up. I ended up editing my original question instead. I modified it and answer is now down below.
    – calfie
    Commented Jun 10, 2021 at 20:11

1 Answer 1

1

UPDATE

I went and followed Clive's suggestions. Since Node A and Node B use the same content type, I added in a relationship on the entity field where Node A references Node B. Then I added in a contextual filter on the content type form field (which is used in Node B), making sure the filter uses the relationship defined under Relationship. Finally I had to tweak the webform field called under Fields to use the relationship. All of these modifications now allow me to call and display the webforms needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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