This all sounds great. My client needs such a thing. But does it works with the views module? And which versions are needed? I would love to hear your experience.

Amnon

Comments

lemark’s picture

I'm not sure if I clearly understand your question.
Bundle Inherit module itself is not integrated with Views module. However, if you need to create views based on inherited entities (content types) it is no need in any kind of special integration. So yes, you can create views on inherited content types.

jordisan’s picture

lemark,
I think one possible feature would be adding a "FILTER BY CONTENT TYPE AND ITS SUBTYPES" in views, so you could filter all nodes belonging (or not belonging) to a content-type or any of its inherited subtypes; or better, add a checkbox "include subtypes" in current content-type filter.

Nowadays, I think the only way to do that is selecting individually every content subtype.

By the way, nice job! I've been searching for subtyping functionality for a while for my personal project, and I think it's currently the best way to create content subtypes. Don't let this module die :)

autopoietic’s picture

The Content Type Groups module allows views integration - eg filter by nodes of a type that is within a 'content type group'.

Using this module in parallel with bundle inherit would be one way of creating sensible and reusable filter groups, prior to any direct views integration from bundle inherit. You would have to create the 'content type groups' to match your inheritance families manually in the ui (or there is an API).

itangalo’s picture

Status: Active » Needs review
StatusFileSize
new2.71 KB

This patch provides some Views integration for bundle_inherit_node, exposing the parent content type to Views for filtering (and also display and sorting).

The patch does not provide means to filter on content type *or* the content *parent* type, but this can be accomplished using Views' neat "or" functionality for filters.

The patch depends on this patch: http://drupal.org/node/1701566#comment-6277708 (just renaming the table defined by bundle_inherit).

itangalo’s picture

Here's a short video showing how to use the patch: http://youtu.be/DEA7iIUib3o

itangalo’s picture

Title: Can I create views on inherited content types? » Use Views to restrict on parent content type
StatusFileSize
new3.97 KB

Updated with a new patch. The previous one would fail if two bundles share the same machine name. (That is if, say, a vocabulary and a content type share the same name.)

Also updating issue title.

alexweber’s picture

Thanks for the great work, going to check this out as I need this for a project.

alexweber’s picture

Thanks for the patch Johan! I was just recently give co-maintainership by lemark and I'll take a look at this and hopefully commit it in preparation for a stable beta version!

alexweber’s picture

Assigned: Unassigned » alexweber
itangalo’s picture

Another update to the patch!

Thanks to http://grasmash.com/article/demystifying-views-api-developers-guide-inte..., I now know a better way of adding additional conditions to a Views query, so there is no need to have a special relationship handler. Simpler patch attached.

alexweber’s picture

Status: Needs review » Needs work

Johan, the patch failed to apply against 7.x-1.x-dev (we committed a bunch of stuff yesterday)

Could you please re-roll?

Thanks!

itangalo’s picture

Will do! I'll get back tomorrow with a new patch.

itangalo’s picture

Status: Needs work » Needs review
StatusFileSize
new3.31 KB

Re-rolled against 1.x-dev!

alexweber’s picture

Awesome, thanks! I'll take a look at it as soon as I get home later on tonight :)

alexweber’s picture

Status: Needs review » Fixed

Committed in 886a8ff, thanks! :)

Note, this patch depends on #1701566: Change bundle_hierarchy to bundle_inherit? which will get committed in a few minutes.

Status: Fixed » Closed (fixed)

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