Views Contextual Filter - Entity Fields

Categories

Component ID

2070451

Component name

Views Contextual Filter - Entity Fields

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Have you ever set up a contextual filter in Views, and needed to change the default argument to "PHP code" to fetch a field from the current node? This module aims to avoid solutions like this:

<?php
// From http://drupal.stackexchange.com/questions/25148/views-and-contextual-filters-with-entity-reference-field
$node=menu_get_object();
return $node->field_event_artistref['und'][0]['target_id'];
?>

When enabled, this module provides a new default argument handler with the label "Field value from current entity". Once selected, you can choose the field to fetch the default value from.

Note that this module has only really been thoroughly tested and used by the author for fetching the following field types:

  1. Taxonomy reference
  2. Node reference (using References module)
  3. User reference (using References module)