March 2019
Intermediate to advanced
580 pages
15h 3m
English
The data about the teams our players belong to is stored in a different table. This means that, at a database level, a join will have to be created to pull them together. In Views lingo this is a relationship in the sense that one table relates to another and the way these are declared is directional from a field to another from the joined table. So, let's see how we can define the team_id field from the players table to join with the teams table on its id field:
$data['players']['team_id'] = array( 'title' => t('Team ID'), 'help' => t('The unique team ID of the player.'), 'field' => array( 'id' => 'numeric', ), 'relationship' => array( 'base' => 'teams', 'base field' => 'id', 'id' => 'standard', 'label' => t('Player team'), ...Read now
Unlock full access