Sorry for my english, but I struggle with this matter for too long now, and I want to know the proper way to display relationship datas in Views.

Assume you have a relationship between data that you have set this way in ViewsData :

class MainViewsData extends EntityViewsData {
  public function getViewsData() {
    $data = parent::getViewsData();

    $data['main_table']['table']['base'] = [
      'field' => 'id',
      'title' =>$this->t('Main'),
      'help' =>$this->t('The Main ID')

    $data['main_table']['id'] = [
      'title' => t('Left'),
      'help' => t('Associate main with Left'),
      'relationship' => [
        'label' => t('Linked left'),
        'base' => 'left_table',
        'base field' => 'main_id',
        'id' => 'standard',

    return $data

How can you get the associated data in the left table as a multivalue field? In a programmatic way?

So far, Views duplicate the results that are linked to multiple values in the left table, according to the result of the SQL query, but I can't define the linked field as a multivalue field.

So I lean toward a specific relationship handler, but it doesn't seem such an unusual situation. What am I missing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.