3

I use Inline Entity Form to embed nodes within nodes.*

When editing these nodes, the embedded nodes appear as one block within Panels, so I cannot re-arrange the fields inside the embedded nodes:

Current Situation

I would like to split out the nodes into separate panes. I would also like to be able to re-arrange the fields in each embedded node using Panels drag-and-drop interface, as in this mock up:

Mock up of desired space

How can I achieve this?

Mini Panels lets you get the first child node only. Views Context gets all the embedded nodes. However, it will lump similar fields together. (e.g. all the image fields will be displayed in one pane).

*(Embedding nodes within nodes is useful as each separate node can hold a group of fields. The effect is similar to Field Collection, but there are extra advantages such as being able to share content between nodes).

  • 1
    I have found that you can use mini-panels to achieve part of what I want, but there are some draw backs: 1) Mini Panels don't work with the In Place Editor 2) In the mini panel, you have to create a separate relationship for each embedded node. So if you have a lot of embedded nodes, that's a lot of relationships! – big_smile Sep 7 '12 at 13:09
  • Quick clarification question: when you say "When editing these nodes", do you mean editing their display in the panels Content page, or do you mean on the Node edit form when editing the content of the parent node? – user568458 Sep 10 '12 at 12:13
  • I mean editing the display with panels (i.e.e re-arranging the field positioning). Sorry, I should have made that clearer. – big_smile Sep 10 '12 at 12:41
  • No problem, that's what I thought you probably meant, just checking – user568458 Sep 10 '12 at 13:06
  • Looking at the question again, when you say "the fields in the 3 child nodes have been re-arranged", do you mean EVERY individual child node can be re-arranged by hand by the user, so each one could be different even though they are the same content type in the same list? If that's right, skip to my last comment about Panel nodes. It's not very clear what you mean, since in the image they all have the same layout. – user568458 Sep 12 '12 at 22:37
1
+150

First, just checking I've understood the problem correctly (please correct me if wrong):

  • You have a page set up using panels, on which you want to display a node and that node's child nodes.
  • You want a list of child nodes that is configurable. Mini panels don't work well for as the number of child nodes can vary.
  • Panels is essential, Inline Entity Form is not necessarily essential but is the best option you've found so far for giving nodes child nodes

If this is right, I wonder if you couldn't get what you want using Context Views in panels that use relationships from Relation module (or Entity Reference might do the job more simply - Inline Entity Form might work the same way too but I don't know how well it integrates with Views). After all, lists of any number of items from one relationship with configurable fields is something Views is designed for, and using a context view allows you to chop the view up in Panels and place each part of the view in a way that suits your layout:

  • Create a directional relation type between the appropriate node types - let's call it 'Is child of' (or, add an entity reference field to the parent node content type)
  • Create a view block showing content and give it a Context display ( context displays are a display type along the top like Page, Block...)
  • Give it a contextual filter for the Nid of the parent node, and a required relationship using the entity reference or relation to get the referred child node (if it doesn't work first time, the last time I used relation with views you had to chain node>relation and relation>node relationships to get the other node. Direct node>node relationships didn't work. Might be fixed by now)
  • Add and configure your fields however you want them in Views, using the 'Is child of' relationship for each of them
  • In Panels, load the view as context on the Panels Context page (make sure the view's contextual filter gets the nid somehow)
  • In Panels Content page, you'll find the elements of your view under View Context. You can place all rows (each row being one child node), individual rows or row ranges, and header, footer, exposed filters etc whereever you like in your panels layout.

The individual fields within each 'embedded' child node are controlled in Views - which has all the flexibility of Panels plus extra features for rewriting, tailoring and combining individual fields - and the display between the child nodes and each other and other page elements is controlled in Panels.

If you choose Relation, you can also add fields to the linking relation itself, which can be included in each row of the view. I believe you could also have one multiple endpoint relation where one parent has several children on the same relation entity sharing the same relation fields. Not sure if they've got those cases working with Views yet, though. Entity Reference is less powerful, but simpler.

  • I've tried doing this, but it seems you have to re-organize the fields with views, rather than panels. Am I doing something wrong? – big_smile Sep 10 '12 at 15:19
  • @big_smile Not doing anything wrong at all - Views is ideal for organising fields in cases where there are lists or multiples of things of the same type (as here where there can be multiple child nodes): it's what it's optimised for and makes use of its features like sorting, pagination, filters, etc. Views also has finer control over the fields - for example, re-writing. The Panels family (Panels, mini-panels, cTools Page Manager...) are best for organising a variety of singular things of different types. It's really common to configure a list in Views, and then place the list in Panels. – user568458 Sep 10 '12 at 16:24
  • This is why you're having trouble with mini-panels - it's designed for mixing things of different types, not for a number of things (child nodes) of the same type, so you end up needing lots of relationships. In views, you create the relationship once, and it's used once to get all the related content in one efficient query. It's what it's designed to do :) – user568458 Sep 10 '12 at 16:25
  • And with the Context View, you can customise how the view is displayed using Panels - for example, you could have the first child node in one column with a class that highlights it, child nodes 2-4 (if there are that many) in a side column, a pager above and below this side column... or whatever works for your layout. If you need fields wholly seperate from each other, like in different Panels regions or columns, you could maybe split them between the main view and an Attachment View and place these seperately in Panels... not sure as I've never needed to do that. – user568458 Sep 10 '12 at 16:31
  • I've been following your guidance. However, even when using views, all the content seems to be lumped together. For example, you can chose to display the body_text_field in a panel by using Views Context. But then all the body_text_field for all the child nodes are lumped together in a sample panel. Is there anyway to output these fields as separate panels? Thanks for any help you can offer! – big_smile Sep 12 '12 at 9:18
2

Try using user568458's solution, but instead of displaying fields in the view, display a "fully rendered node" and set the view mode to a custom view mode.

To customize a view mode, and then configure the layout of a custom view mode, use Display Suite module.

See this about view modes.

If you activate Display Suite's sub module Panel View modes, you can then use the Panels module interface, instead of Display Suite for layouts.

EDIT I just went to do this myself and discovered that this feature has disappeared in the latest version of Display Suite!

Bummer :(

However, you can still utilize Display Suite to a lesser degree... Sorry

  • Nice video, +1. If the asker allows users to customise content types, and they want users to be able to create one custom layout for everything in each content type, this will work and fill in the last piece of the puzzle. I'm not clear whether they want the customisation to be for each page layout, each content type, or each individual node... Anyway between this tip, my comment about Panel nodes, and everything else, I think we've got an option for every single possibility!!! (p.s. Panel View Modes is in Display Suite not Panels - editted) – user568458 Sep 12 '12 at 22:30
  • thanks for the edit -- i recently started using Display Suite view modes and I absolutely love it – tmsimont Sep 13 '12 at 0:54

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.