0

I would like to be able to create a page to show teasers from content created with a certain content type, say "Company" together with teasers from Users content.

Until now, I just managed to create either a view to show the teasers of the Company content type, OR the teasers of the Users. But not both. When I add a relation, I can use fields of both in the same block, but I would like to show a page with separate blocks of both companies and users together.

How should I do such a thing, if even possible?

  • Mixing two entity types like this in a single query is not supported. The database query would be a massive headache to generate, for one thing. You could execute two queries and merge the results programatically but if you want pagination it'll be tricky. – Alfred Armstrong Nov 4 at 10:43
  • Thanks, I was hoping there would be a way to do this without leaving the Drupal UI – C.A. Vuyk Nov 4 at 10:55
1

Since you say that you would like to show a page with separate blocks of companies and users, there's no need to do this all in the same View.

Create two different Views with Block displays. One for the teasers of Company content type, one for the teasers of the Users. (You have done this much already.)

Then, place both of those Blocks in theme regions on the same page, and they should both appear ... together, but separately.

  • Thanks for your answer. This would create a page with no possibility to do filtering and pagination I think? – C.A. Vuyk Nov 4 at 17:26
  • Pagination will be a challenge. I think you should be able to filter and sort each of the blocks, but separately. You won’t be able to mix the results together, but you did say that you want separate blocks. – hotwebmatter Nov 4 at 18:37
  • It's not quite what I was looking for. There's no better answer, I'll accept this one. – C.A. Vuyk Nov 4 at 18:39

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.