O'Reilly logo

Drupal 8 Module Development by Daniel Sipos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Views relationships

The fact that the data about the teams our players belong to is stored in a different table 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required