I'm trying to create a view that lists the groups a particular member belongs to. In Drupal 6, this was possible with both a filter and arguments.
Currently, I got the view working with a view of type "User," and an argument on Group ID. However, the User type does not have any available relationships, and the only useful field for display purposes is that Group ID number, which isn't exactly what I'm looking for.
Am I missing something here, or should I concern myself with trying to build out further views integration?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idiotprayer’s picture

Title: Lists groups for specific user » List groups for specific user
amitaibu’s picture

Status: Active » Fixed
FileSize
2.63 KB

You can use this exported View, It's still very simple - you just show the "group audience" field.

idiotprayer’s picture

That's the view that I had working, except listing the group_audience_gid field. The problem for me then is missing handlers in views 3, because any added fields are not available for the User type.
For example, if I'd like to create a list of the current user's groups, but also show a logo or a tagline for each one, those fields are not accessible to me through a view of this type. I could certainly solve the problem with a little inserted php, but this seems less than ideal.

idiotprayer’s picture

Title: List groups for specific user » List fields per group for specific user
Status: Fixed » Needs work

Changing status and title

amitaibu’s picture

Status: Needs work » Active

I understand, we'll have to create a new handler similar to group_audience_gid that will return the group's label and optionally link to the it. Do you volunteer? ;)

idiotprayer’s picture

I will work on a patch, although I'm still trying to wrap my head around views 3 and entity relationships in 7.

floretan’s picture

Status: Active » Needs review
FileSize
2.46 KB

Here's a patch that makes relationships available based on the group_audience fields, both from the entity referencing the group and from the group being referenced.

Combining these relationships with arguments and filters makes it possible to solve the case mentioned above and many more.

The patch is fairly well tested, I'm using this for a project with some decent simpletest coverage.

idiotprayer’s picture

This patch works for me. I had cobbled together a similar solution but it only worked for specific joins, and I hadn't had a chance to clean it up and make it actually useful.
For my use case it is as simple as adding Group: Node Group and Group: User Group relationships, and the User: Uid argument.

amitaibu’s picture

@flobruit,
1) wow! :)
2) When you add a relationship (e.g. Group: group_audience) all the relationships are duplicated.
3) Can you also share an export of your view that gets idiotprayer's needs.

Are you already using OG on a D7 project? How's it working for you?

idiotprayer’s picture

Here's the export for my use case.
We launch an internal alpha on a D7 project using OG next week, and for the most part it has been up to the task. I imagine as we add features I will be back here with more, and hopefully able to contribute some patches myself.

$view = new view;
$view->name = 'og_list';
$view->description = 'Show active groups that are nodes';
$view->tag = 'group';
$view->base_table = 'node';
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['title'] = 'Groups list';
$handler->display->display_options['access']['type'] = 'none';
$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'] = 'full';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
  'created' => 'created',
);
$handler->display->display_options['style_options']['default'] = 'title';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 1,
    'align' => '',
    'separator' => '',
  ),
  'created' => array(
    'sortable' => 0,
    'align' => '',
    'separator' => '',
  ),
);
$handler->display->display_options['style_options']['override'] = 1;
$handler->display->display_options['style_options']['sticky'] = 0;
/* Relationship: Group: Node group */
$handler->display->display_options['relationships']['og_rel']['id'] = 'og_rel';
$handler->display->display_options['relationships']['og_rel']['table'] = 'node';
$handler->display->display_options['relationships']['og_rel']['field'] = 'og_rel';
$handler->display->display_options['relationships']['og_rel']['label'] = 'Node Group';
$handler->display->display_options['relationships']['og_rel']['required'] = 0;
/* Relationship: Group: User group */
$handler->display->display_options['relationships']['og_rel_1']['id'] = 'og_rel_1';
$handler->display->display_options['relationships']['og_rel_1']['table'] = 'users';
$handler->display->display_options['relationships']['og_rel_1']['field'] = 'og_rel';
$handler->display->display_options['relationships']['og_rel_1']['label'] = 'User Group';
$handler->display->display_options['relationships']['og_rel_1']['required'] = 0;
/* Field: Node: 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']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Fields: field_group_logo */
$handler->display->display_options['fields']['entity_id']['id'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['table'] = 'field_data_field_group_logo';
$handler->display->display_options['fields']['entity_id']['field'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['label'] = '';
$handler->display->display_options['fields']['entity_id']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['trim'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['html'] = 0;
$handler->display->display_options['fields']['entity_id']['hide_empty'] = 0;
$handler->display->display_options['fields']['entity_id']['empty_zero'] = 0;
$handler->display->display_options['fields']['entity_id']['settings'] = array(
  'image_style' => 'group_icon',
  'image_link' => '',
);
/* Argument: User: Uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'users';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['uid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['uid']['not'] = 0;
/* Filter: Group: Group's state */
$handler->display->display_options['filters']['state']['id'] = 'state';
$handler->display->display_options['filters']['state']['table'] = 'og';
$handler->display->display_options['filters']['state']['field'] = 'state';
$handler->display->display_options['filters']['state']['relationship'] = 'og_rel';
$handler->display->display_options['filters']['state']['value'] = array(
  1 => '1',
);
$handler->display->display_options['filters']['state']['expose']['operator'] = 'state_op';
$handler->display->display_options['filters']['state']['expose']['label'] = 'Group: Group\'s state';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['path'] = 'group-list';

/* Display: My Groups */
$handler = $view->new_display('block', 'My Groups', 'block_groups_list');
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'grid';
$handler->display->display_options['style_options']['columns'] = '2';
$handler->display->display_options['style_options']['fill_single_line'] = 1;
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Node: 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']['label'] = '';
$handler->display->display_options['fields']['title']['exclude'] = TRUE;
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Fields: field_group_logo */
$handler->display->display_options['fields']['entity_id']['id'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['table'] = 'field_data_field_group_logo';
$handler->display->display_options['fields']['entity_id']['field'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['label'] = '';
$handler->display->display_options['fields']['entity_id']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['trim'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['html'] = 0;
$handler->display->display_options['fields']['entity_id']['hide_empty'] = 0;
$handler->display->display_options['fields']['entity_id']['empty_zero'] = 0;
$handler->display->display_options['fields']['entity_id']['settings'] = array(
  'image_style' => 'group_icon',
  'image_link' => 'content',
);
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Argument: User: Uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'users';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['uid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['uid']['not'] = 0;

/* Display: All Other Groups */
$handler = $view->new_display('block', 'All Other Groups', 'block_1');
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'grid';
$handler->display->display_options['style_options']['columns'] = '2';
$handler->display->display_options['style_options']['fill_single_line'] = 1;
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['relationships'] = FALSE;
/* Relationship: Group: User group */
$handler->display->display_options['relationships']['og_rel_1']['id'] = 'og_rel_1';
$handler->display->display_options['relationships']['og_rel_1']['table'] = 'users';
$handler->display->display_options['relationships']['og_rel_1']['field'] = 'og_rel';
$handler->display->display_options['relationships']['og_rel_1']['label'] = 'User Group';
$handler->display->display_options['relationships']['og_rel_1']['required'] = 0;
/* Relationship: Group: Node group */
$handler->display->display_options['relationships']['og_rel']['id'] = 'og_rel';
$handler->display->display_options['relationships']['og_rel']['table'] = 'node';
$handler->display->display_options['relationships']['og_rel']['field'] = 'og_rel';
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Node: 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']['label'] = '';
$handler->display->display_options['fields']['title']['exclude'] = TRUE;
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['text'] = '[entity_id]';
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Fields: field_group_logo */
$handler->display->display_options['fields']['entity_id']['id'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['table'] = 'field_data_field_group_logo';
$handler->display->display_options['fields']['entity_id']['field'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['label'] = '';
$handler->display->display_options['fields']['entity_id']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['text'] = '<a href="[title]">[entity_id]</a>';
$handler->display->display_options['fields']['entity_id']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['path'] = '[path]';
$handler->display->display_options['fields']['entity_id']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['alt'] = '[title]';
$handler->display->display_options['fields']['entity_id']['alter']['trim'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['html'] = 0;
$handler->display->display_options['fields']['entity_id']['hide_empty'] = 0;
$handler->display->display_options['fields']['entity_id']['empty_zero'] = 0;
$handler->display->display_options['fields']['entity_id']['settings'] = array(
  'image_style' => 'group_icon',
  'image_link' => 'content',
);
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Argument: User: Uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'users';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['uid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['uid']['not'] = 1;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter: Group: Group's state */
$handler->display->display_options['filters']['state']['id'] = 'state';
$handler->display->display_options['filters']['state']['table'] = 'og';
$handler->display->display_options['filters']['state']['field'] = 'state';
$handler->display->display_options['filters']['state']['relationship'] = 'og_rel';
$handler->display->display_options['filters']['state']['value'] = array(
  1 => '1',
);
$handler->display->display_options['filters']['state']['expose']['operator'] = 'state_op';
$handler->display->display_options['filters']['state']['expose']['label'] = 'Group: Group\'s state';
$translatables['og_list'] = array(
  t('Defaults'),
  t('Groups list'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort By'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('Offset'),
  t('Node Group'),
  t('User Group'),
  t('Title'),
  t('All'),
  t('Group: Group\'s state'),
  t('Page'),
  t('My Groups'),
  t('All Other Groups'),
  t('group'),
  t('[entity_id]'),
  t('<a href="[title]">[entity_id]</a>'),
  t('[path]'),
  t('[title]'),
);
floretan’s picture

The duplicate relationships are due to the fields being defined once for the entity and one for the entity's revisions. I noticed that before but I forgot to mention that in my comment. I'm not sure yet how this should be handled.

Here's a simple view that lists the groups of which the current user is a member (it's assuming that you have a content type called "group"). Idiotprayer posted one while I was writing this comment, but mine is slightly different so here it is anyway:

$view = new view;
$view->name = 'my_groups';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$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'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: Group: Node group */
$handler->display->display_options['relationships']['og_rel']['id'] = 'og_rel';
$handler->display->display_options['relationships']['og_rel']['table'] = 'node';
$handler->display->display_options['relationships']['og_rel']['field'] = 'og_rel';
$handler->display->display_options['relationships']['og_rel']['required'] = 1;
/* Relationship: User: group_audience */
$handler->display->display_options['relationships']['entity_id']['id'] = 'entity_id';
$handler->display->display_options['relationships']['entity_id']['table'] = 'field_data_group_audience_users';
$handler->display->display_options['relationships']['entity_id']['field'] = 'entity_id';
$handler->display->display_options['relationships']['entity_id']['relationship'] = 'og_rel';
$handler->display->display_options['relationships']['entity_id']['required'] = 1;
/* Field: Node: 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']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Filter: Node: 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',
);
/* Filter: User: Current */
$handler->display->display_options['filters']['uid_current']['id'] = 'uid_current';
$handler->display->display_options['filters']['uid_current']['table'] = 'users';
$handler->display->display_options['filters']['uid_current']['field'] = 'uid_current';
$handler->display->display_options['filters']['uid_current']['relationship'] = 'entity_id';
$handler->display->display_options['filters']['uid_current']['value'] = '1';

The D7 project we're using OG is relatively simple, OG is mainly used to manage the access restriction of a redaction workflow. What's nice with the D7 version is that we can associate certain taxonomy terms with a group using the group_audience field, and automatically put articles in groups based on their terms using just a few lines of custom code. This extra level of flexibility is perfect for the complexity of our client's organisation.

Building a site with D7 can be a bit challenging sometimes, but OG has been one of the least problematic modules so far.

amitaibu’s picture

Title: List fields per group for specific user » Add views relationships to entity provided by entity API
Project: Organic groups » Entity API
Component: Og Views » Entity CRUD API - main

> but OG has been one of the least problematic modules so far.

Phew, I'm happy to hear that. I'd be happy if you guys could continue and share your use cases, as those are best to get OG ready.

About the patch in #7, I think that this a task the Entity API or entity-metadata can/ should do, as "og" table is actually the "group" entity. So what we do here is create a relationship to an entity. I'm moving this to entity API, to get fago's thoughts about it.

fago’s picture

Title: Add views relationships to entity provided by entity API » Add views integration
Category: feature » task
Status: Needs review » Active

Adding views integration for entity provided by the CRUD API sounds good to me. I thought about that already, but had no time to do it yet. Best, let's add another controller ('views controller'), that if activated provides the Views integration for the entity base table.
As source for property labels and descriptions, we could use the info of entity metadata for each schema-field. That way a module would have to provide it only once. However, that would also mean we would have to require entity-metadata for the views integration to work - or at least for having more fields than just the id? :)

For relationships then, you need the table to join. For fields I guess http://drupal.org/project//efq_views is the best way to go. I guess it won't handle non-fields, so non-field entity-relations would have to be added in manually.

Makes sense?

amitaibu’s picture

> For relationships then, you need the table to join

Indeed, so where do you think this data should live, in the metadata_info()?

fago’s picture

>Indeed, so where do you think this data should live, in the metadata_info()?

hm, I think its best for the providing module to just implement views integration for its field type, as that's not really related to the entity API. However, as said I think providing views integration for the entity base table of an entity via an views controller would fit very well into the module.

chx’s picture

Component: Entity CRUD API - main » Core integration

This issue blocks profile2 from being usable as far as i understand these things.

chx’s picture

Component: Core integration » Code - misc

sorry...

idiotprayer’s picture

@amitaibu as I understand it, my original goal is unattainable via floruit's patch (which relies on depreciated sql field api) or the efq_views module (awesome though it is, we need relationships for this). So we still need a proper views controller for og, correct?

fago’s picture

Status: Active » Needs review
FileSize
7.46 KB

I've took a stab on that and implemented some views integration, which is generated with the help of schema and property info. Seems to work although profile2 needs a little property info improvement ('views field' => 'uid') such that the owner relationship is generated.

bojanz’s picture

Interesting start!

What about supporting properties that don't map directly to db columns?

#975400: Refactor field render() functions to accept $value, allowing reuse just got committed to Views 6.x-3.x, after it gets ported to 7.x-3.x (I'll probably do it tonight), then the handlers can become 5 lines long, making it possible for Entity to provide it, instead of efq_views and search api doing it themselves.

In general I'm trying to see how this affects efq_views and how many code parts (that concern Entity integration) could be moved to Entity itself.

fago’s picture

Status: Needs review » Fixed

I've some small improvements to #19
* to also work for the type 'token'
* to not add in serialized fields
* to work with relations to exportable entities
and committed it, so we have a first start now. In my tests it worked fine for listing profiles + their fields.

>What about supporting properties that don't map directly to db columns?

I think in that case it's best to just letting modules add in the views fields themselves, as the entity API cannot know how to join or whether the property is somewhere in the db at all.

>In general I'm trying to see how this affects efq_views and how many code parts (that concern Entity integration) could be moved to Entity itself.

Awesome to see that patch getting committed! Yes, I think adding some generic views handlers suiting for entities makes much sense, so modules like efq_views and the search api can share them. Stuff I could think of would be
* a basic field handler that supports linking to an entity
* a entity label field
* a entity status field displaying the exportable status
* some generic handlers that work based upon property info (options list)

Then maybe it would be we'd could introduce a general helper function that returns views field info defaults for some given property info?

Anyway, let's deal with that in follow-up issues and set this to fixed as we have basic views integration now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ben kuper’s picture

Status: Closed (fixed) » Active

I tried the latest cvs version, latest dev, with and without the entity-views.patch but i can't get the "profile type" view to be displayed... I succeeded last week but on a fresh install, no way to get it...

ben kuper’s picture

Status: Active » Closed (fixed)

Sorry, after 5 or 6 cache clear it seems that it worked with both latest dev version

sun’s picture

Minor, but relatively important follow-up: #1066398: Reverse entity relationships for Views integration