1

Im on d7. I have two content types; Topics and Groups. There are 10 groups and when a user submits a topic, they choose a group to put it into. I use entity reference to connect the two content types. There is a ER field on the Topic content type where a user can choose up to 2 Groups for the topic to be in. On the Topic node page I need a block that shows all the other topics that are in the same Group.

What Ive tried:

I have a views block set up that shows the Groups content type. There is a Entity Reference: Referencing entity relationship and a Content: Nid contextual filter that uses the relationship.

I have just one field of Content:Title that is also using the relationship.

The only thing that is showing is the one same Topic who's node page im on (and there are more topics in the same group that should be showing).

Please help me figure this out. Thanks.

Edit:

Here is the way I have the view set up.

$view = new view();
$view->name = 'similar_topics';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'similar_topics';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'test';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none'; 
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: Entity Reference: Referencing entity */
$handler->display->display_options['relationships']['reverse_field_group_node']['id'] = 'reverse_field_group_node';
$handler->display->display_options['relationships']['reverse_field_group_node']['table'] = 'node';
$handler->display->display_options['relationships']['reverse_field_group_node']['field'] = 'reverse_field_group_node';
$handler->display->display_options['relationships']['reverse_field_group_node']['required'] = TRUE;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['relationship'] = 'reverse_field_group_node';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: Content: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['relationship'] = 'reverse_field_group_node';
$handler->display->display_options['arguments']['nid']['default_action'] = 'default';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'node';
$handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = 
array(
'group' => 'group',
);

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;

An example of what is happening is if there is 2 topics in a group, it will show the same topic that the node page is, two times.

0

Make sure that you set Provide default value in your contextual filter(nid) and set it

Content ID from URL 

Also check Require this relationship in your entity relationship.

its works fine for me.

  • Thanks for the reply. Hmmm.. I have the content id as the default value and I have the relationship required. Ill export the way I have it set up above. – oobie11 Dec 9 '12 at 23:00
0

After playing with it over and over, the only way to accomplish what I needed was to use views field view. Using this way seem incredibly hackish so if anyone has a better way, please let me know.

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.