Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By dawehner on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
In order to simplify the way to integrate a module with views , hook_views_api() has been removed. This means that you can no longer place the .views.inc file in a subdirectory. It now must be in a .views.inc file in the root of your module.
Drupal 7
foo/foo.module
function example_views_api() {
return array(
'api' => 3.0,
);
}
foo/views/foo.views.inc
function foo_views_data() {
...
}
Drupal 8
foo/foo.views.inc
function foo_views_data() {
...
}
Impacts:
Module developers
Comments
Hooks which must be run
Hooks which must be run during each view execution, such as hook_views_query_alter() must placed in foo.views_execution.inc, rather than foo.views.inc.