Score:1

Parent node needs to display the scheduled date that is referenced in the child node

sa flag

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?

cn flag
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
mx flag
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).
calfie avatar
sa flag
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.
Jaypan avatar
de flag
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!
calfie avatar
sa flag
Thanks for the heads up. I ended up editing my original question instead. I modified it and answer is now down below.
Score:1
sa flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.