Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Exposing Your Modules Tables to Views

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:02
    [Coding for Views for Drupal 7, Chapter 7 with Joe Shinderlar]
  • 0:04
    In this chapter, we're going to take a look at
  • 0:06
    implementing hook_views_data in order to expose
  • 0:09
    our databasics modules tables to the views module.
  • 0:14
    In views, we do this by returning a big array that describes
  • 0:18
    the table itself and all of the columns on that table.
  • 0:21
    We need to tell the views module things like the name of our table
  • 0:24
    and the name of each individual column,
  • 0:27
    and it needs to know both the machine readable name of the column
  • 0:30
    and a human readable name that it can use in the user interface
  • 0:02
    [Codificando para Views para Drupal 7, Capítulo 7 com Joe Shinderlar]
  • 0:04
    Nesse capítulo, iremos dar uma olhada
  • 0:06
    na implementação de hook_views_data para expor
  • 0:09
    as tabelas do nosso módulo Databasics ao módulo Views.
  • 0:14
    Em Views, fazemos isso retornando um grande array que descreve
  • 0:18
    a própria tabela e todas as colunas nessa tabela.
  • 0:21
    Precisamos dizer ao módulo que procure por coisas como o nome da nossa tabela
  • 0:24
    e o nome de cada coluna individual,
  • 0:27
    e precisa saber ambos nomes de máquina da coluna
  • 0:30
    e nome legível por humanos para que possa usar na interface de usuário

Exposing Your Module's Tables to Views

Loading...

In this video Joe looks at using hook_views_data() in order to describe a database table to views such that views is capable of making queries to that table. We’ll talk about describing the table itself, and how to get it to appear in the views UI as an option that can be used as a base table.

Downloads: 
Log in or sign up to download companion files.
Additional resources: 

Modules Needed