In this video I'll show you how to configure panels to control the layout of our groups.
Install modules
- Panels
- Entityreference prepopulate (This will let us place “Create content” links on group nodes, and have the content automatically post to the group where you clicked the link.)
Enable modules
- Page manager
- Entity reference prepopulate
-
Panels
The group layout will consist of the node body, list of OG members a subscription link, and a link to create content.
Configure Panels
- Go to "Structure => Pages" (admin/structure/pages)
- Enable "Node Template" (When enabled this will allow us to override the way nodes are displayed.)
- Edit "Node Template"
- Click "Add a new variant"
- Title: Group Layout
- Optional features: Select Selection rules
- (Create variant)
- Select "OG: Node is an OG group" from the drop down menu then click (Add) (This means that the layout will be applied if the node being viewed is an OG Group)
- (Continue)
- Click "Add a new variant"
Configure variant
- Under Category, select "Builders"
- (Continue)
- (Optional: Check the "Disable Drupal blocks/regions". Use it if you want to disable the sidebars etc.)
- (Continue)
- (Optional: Set title to )
- (Create variant)
Adding content
Before I layout the panel I'm going to add all of the content.
To add content:
- Click on the gear icon in the Center region
- Click "Add content"
- Click "Node"
- Choose "Field: Body (body)"
- (Continue)
- (Finish)
- Click "Organic groups"
- Choose "content create links "
- Field name: Groups audience (og_group_ref)
- [ ] Restrict to content types (You can select content types that you would like to use the “Content create links”. If you do not select any content types, they will be shown on all group types.)
- (Finish)
- Click “View panes”
- Choose "OG content"
- (Finish)
- Click “View panes”
- Choose "OG members"
- (Finish)
- Click “Node”
- Choose "Field: Group (group_group)"
- Select "Override title"
- Override title: Group membership
- Select a formatter: choose "OG subscribe link"
- (Continue)
- (Finish)
- Click "Add content"
- (Update and save)
Layout the panel
Now let's layout the panel. I'll make a two column panel with the right column being about 33% wide and a region on top for the group description.
- (Show Layout Designer)
- Click "Row"
- Choose "add region to right"
- Region title: Right region
- Width: Fluid (You could select Fixed and set an exact pixel width, but I'm going to set a fluid width so that it can expand and contract.)
- (Save)
Now drag the divider to about 33%
- Click "Column"
- Choose "add Row to top"
- (Save)
Next, I will add a Region in the top row, this will be for the group description
- Click "Row"
- Choose "add region"
- Region title: Top region
- Width: Fluid
-
(Save)
-
(Update and save)
Now we can move everything by dragging and dropping content to their appropriate places:
Top region:
* "Node being viewed" Body
Right region:
* OG Content create links
* OG members
* "Node being viewed" (Group) (This is the subscribe link)
Center:
* View: OG content
- (Update and save)
To see if everything turns out the way we want them, go ahead and click home button then Group #1. You may notice here that we don’t see the “Content create links” to create an article. In order for content types to show up in that list, we need to edit the “Groups audience” field and configure some preferences for Entity reference prepopulate. Let’s do that now.