0

I have a drupal 7 site using Organic Groups, for each group I have list pages - so for instance if i have the group mygroup I have a page which lists all posts - (www.mysite.com/groups/mygroup/posts). This page has a groups audiance field (og_group_ref) which has the correct gid..

I have the list page set up with panes one of which is a view showing all posts with the contextual filter set to GID.

The view works on its own if I pass in the GID of the group I want, however, I cannot get this to cooperate with the list page, probably something to do with the pane, or panels, or a relationship I need to add to the view?

I've tried inserting the view into the pane as a content pane and as a block, but I'm having no joy...

What do I need to do to get this to work?

I have since found this post:

How do you display a pane in an organic group?

this seems to be the answer to what I'm looking to do, however, the settings shown in that post are not available to me. Maybe because panels/views/og have been updated and the settings are a little different now? Either way I still don't have this working. Does anyone have any pointers?

2
  • Did you check the tutorials at nodeone.se ?
    – RajeevK
    Commented Nov 17, 2013 at 14:31
  • I've had a look - but nothing which has helped solve this for me..
    – BigJ
    Commented Nov 19, 2013 at 21:33

2 Answers 2

0

Simpler solution that works without Token display mode:

  1. Create a "Content pane" view mode of your view, and set "Argument input: Input on pane config".
  2. Create a contextual filter in your view that expects a group ID value.
  3. In the Panels configuration of your list, insert your View pane.
  4. In the View pane config form, there will be a single input field expecting a gid value and saying "You may use keywords for substitutions." below. Enter %node:og_group_ref:nid.

How it works: Panels allows CTools context keywords when supplying arguments to panels. They are automatically available for all fields, and they are chainable like Drupal [tokens]. This is not obvious, since it's not included in the context keywords list (shown after creating a Panel variant, in the panel's content section, after unfolding "Substitutions").

Since a group ID is the node ID of the node functioning as group, %node:og_group_ref:nid will supply the required ID. If your groups are not node entities, they might use a different field for the ID. For example, CiviCRM contact records use cid, so you would supply %node:og_group_ref:nid.

0

Solved it like this:

  1. Create a "Content pane" view mode of your view, and set "Argument input: Input on pane config".
  2. Create a contextual filter in your view that expects a group ID value.
  3. Enable the "Tokens" display mode for content type with the og_group_ref field. According to here:
    1. Go to "Structure → Content Types → [your content type] → Manage Display".
    2. Click "Custom Display Settings" below the field list, enable the "Token" option and save.
    3. Go to the new "Token" display mode in the horizontal tabs on the top.
    4. For yourog_group_ref field, set "Format: Entity id" and save.
  4. In the Panels configuration of your list, insert your View pane.
  5. In the View pane config form, there will be a single input field expecting a gid value and saying "You may use keywords for substitutions." below. Enter %node:og_group_ref.

How I think it works: Panels allows CTools context keywords when supplying arguments to panels. These context keywords are automatically available for all fields (%node:nid works out of the box) and all defined tokens (examples). But for fields, they evaluate to the formatted field value, such as your group's name. We could change this behavior by defining a token of the same name, and choosing a formatter that outputs the raw value (the number) when that token is evaluated.

References:

2
  • 1
    I do it the way that post you linked does it but instead, in my content pane settings, I pass the node:content id as the argument. The option only shows after you've added the contextual filter for group ID. Commented Mar 16, 2016 at 1:40
  • @NiallMurphy, that's where you can select the argument from a long select list, right? Nice, I know the technique but could not get it to work for group IDs. I guess it deserves its own answer, both for embedding the view on the group node and a group content node (as in the original question).
    – tanius
    Commented Mar 16, 2016 at 2:13

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.