When relation types are created by features (or directly implemented using hook_relation_default_relation_types), relations of these types do not show up on /admin/content/relation.

Upon investigation it appears that the query used to generate that page was doing a join to to the relation_type table. The relation_type only contains types created manually.

The following patch corrects this by removing the join and loading the types properly using relation_get_types().

Comments

pasqualle’s picture

Status: Needs review » Reviewed & tested by the community

Yes, this patch works nicely..

---
but I will give up on relation type exports, as I still have issues with it.
in relation_endpoint_field_validate() function

$relation_type = relation_type_load($entity->relation_type);

sometimes the $relation_type->source_bundles and $relation_type->target_bundles is an empty array..
No idea why, when I store the same export into the database, then it works..
Could be something wrong with my custom code..

naught101’s picture

Status: Reviewed & tested by the community » Needs work
-  $query->join('relation_type', 'rt', 'r.relation_type = rt.relation_type');

This join looks right to me. Can we find out first why it isn't working? Is it because the relation_type is missing from the relation_type table, or from the relation table?

phayes’s picture

Hi naught101,

That join is wrong as it assumes that all relation_types are created manually in the admin interface, instead of being implemented using a hook (as features does). When a relation_type is implemented using a hook, it never gets added to the database (nor should it).

mikran’s picture

Component: Code » API
Status: Needs work » Reviewed & tested by the community

phayes is correct on this one.

chx’s picture

Title: /admin/content/relation does not display relations belonging to a type created by features (patch attached) » /admin/content/relation does not display relations belonging to a type exported by ctools

Looks good. I will commit this but a test would make me happier. Also, this has nothing to do with features (I will won't fix immediately any features related bugs as that module in itself is not much more than a bug) but it's a ctools export problem.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, relation.bad_content_query.patch, failed testing.

mikran’s picture

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

Original patch rerolled, tests added and couple of typos fixed in tests

mikran’s picture

StatusFileSize
new3.16 KB

new reroll and whitespace error fixed

mikran’s picture

Status: Needs review » Fixed

committed

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

adding able