2

Is there a way to create a view that will allow showing listing of two entity types, for example combine items from the Content and File Entity Files views?

Lets say we wish to show a listing of all content belonging to a user. We create a view for Content entity, then add user as a required relationship, but this does not show the file fields to be added to the view.

2

Thats tough to answer without a little more information.

It depends on whether or not they share anything in common. Views over on the right hand side of the UI has a menu for what are called relationships. You could for example setup a content type based view and then add a relationship to the user who created the content type node. After the relationship was created you'd then have access to information stored (fields) on the user as well as the fields from the content type itself. What these relationships are doing behind the scenes in views is setting up SQL joins between the various tables in your Drupal database.

Another thing you might want to look into is entity references and taxonomy tags. Both of those can be used to setup connecting points between pieces of content that can be rendered by a view much in the same way.

  • Thanks, I added more information in the original question. – amit Apr 14 '17 at 19:08
  • Ok how does the file field relate to the node content or user content? – Shawn Matthews Apr 14 '17 at 19:09
  • one scenario is perhaps article bundle has some files attached, but another scenario is simply global listing, regardless of bundled relationships – amit Apr 14 '17 at 19:13
  • Currently these aren't available as fields? You might need to switch how you are viewing the entity type within the views to make sure you are viewing by field and can select what is shown. If they are attached to the article the view is based on are they stored via a field on the article content type? – Shawn Matthews Apr 14 '17 at 19:16
  • Ok thanks, this was a complimentary question similar one on programmatic method to do the same task drupal.stackexchange.com/questions/215423/… – amit Apr 14 '17 at 19:22
1

You could use SearchAPI module.

This module provides a framework for easily creating searches on any entity known to Drupal, using any kind of search engine.

With this module you can creare an index with different entity types (nodes, terms, users, files) and show them in a view.

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.