I'm trying to filter using a taxonomy term reference field on a taxonomy term, but it doesn't seem to be working.

Under entity type, I check taxonomy term. Under field name, I select the appropriate reference field. I uncheck empty field, and then type the appropriate tid into the field value box.

Am I supposed to do something else?

Comments

mavimo’s picture

You're right, taxonomy term entity don't have view callback, so it's not possible use hook_entity_view(). I'm working on a patch.
Thanks for report.

mavimo’s picture

Component: User interface » Code
Assigned: Unassigned » mavimo
Category: support » bug
Priority: Normal » Major

Can you try to replace, in content_entity_field the line:

function context_entity_field_entity_view($entity, $type, $view_mode, $langcode) {

with

function context_entity_field_entity_prepare_view($entity, $type, $langcode) {

and give me feedback?

spacegoat1701’s picture

After making the change, I get this error:

EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7562 of /www/catodev2/htdocs/includes/common.inc).

spacegoat1701’s picture

I got it to work by reverting back to hook_entity_view and then adding this underneath for taxonomy terms:

/**
 * Implements of hook_taxonomy_term_view_alter().
 */
function context_entity_field_taxonomy_term_view_alter(&$build) {
  if ($plugin = context_get_plugin('condition', 'entity_field')) {
    $plugin->execute($build['#entity_type'], $build['#term']);
  }
}
mavimo’s picture

Thanks for feedback, I'll try to uniform eentity view managament without split between entity types

spacegoat1701’s picture

That might not be possible until Drupal 7.17, when hook_entity_view is supposed to be added to taxonomy terms.

mavimo’s picture

@SpaceGoat1701: tks for information.

mavimo’s picture

Title: Can't get it to work » Condiction in Taxonomy Term entity type don't work
Status: Active » Reviewed & tested by the community

Title chaged to match with report

mavimo’s picture

Status: Reviewed & tested by the community » Fixed

Commited in 7.x-1.x branch

Status: Fixed » Closed (fixed)

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

mavimo’s picture

Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

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

doublejosh’s picture

Title: Condiction in Taxonomy Term entity type don't work » Condition in Taxonomy Term entity type don't work
Issue summary: View changes

title typo

doublejosh’s picture

Title: Condition in Taxonomy Term entity type don't work » Conditions in Taxonomy Term entity types don't work

typo