6.x-3.x docs.php hook_views_api()
7.x-3.x views.api.php hook_views_api()

Register View API information.

This is required for your module to have its include files loaded; for example, when implementing hook_views_default_views().

Return value

array An array with the following possible keys:

  • api: (required) The version of the Views API the module implements.
  • path: (optional) If includes are stored somewhere other than within the root module directory, specify its path here.
  • template path: (optional) A path where the module has stored it's views template files. When you have specified this key views automatically uses the template files for the views. You can use the same naming conventions like for normal views template files.

Related topics

2 functions implement hook_views_api()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

views_test_views_api in tests/views_test.module
Implements hook_views_api().
views_views_api in ./views.module
Implements hook_views_api().


./views.api.php, line 739
Describe hooks provided by the Views module.


function hook_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'example') . '/includes/views',
    'template path' => drupal_get_path('module', 'example') . '/themes',


hansfn’s picture

mbarfa’s picture

How to use custom table in drupal views.

alexmoreno’s picture

AlxVallejo’s picture

The path is optional yet it defines a path?

zkent’s picture

Quote from above: "If includes are stored somewhere other than within the root module directory, specify its path here."

nrogers’s picture

I didn't see this documented anywhere else so I thought I'd leave this here for the next ignorant person.
Your views include files must end with .views.inc (i.e. filename.views.inc) in order for them to be processed.

sj5515139@gmail.com’s picture

what does api => 3 means to?

flydragon865’s picture

api => 3 meaning you are using the views module version 3.x (e.g. 7.x-3.x)