October 2017
Intermediate to advanced
566 pages
14h 31m
English
The last type of responsibility a View field can have is to be used as an argument (or a contextual filter for Drupal veterans). In other words, configuring the View to be filterable by a parameter that is dynamically passed to it. Let's face it, most of the time if we want to filter by a team, we won't rely on the actual string name as that can change. Instead, we tie everything to the record (by its ID). So that means we'll add the argument key to the team_id field of the players table (which also means that the query won't require a join so it will be more performant):
'argument' => array( 'id' => 'numeric', ),
In this case, we use the NumericArgument plugin, which does pretty much all we need for our data type--it filters ...
Read now
Unlock full access