1.20.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

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

File

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

Code

function hook_views_api() {
  return array(
    'api' => 3,
    'path' => backdrop_get_path('module', 'example') . '/includes/views',
    'template path' => backdrop_get_path('module', 'example') . '/templates',
  );
}