Change record status: 
Project: 
Introduced in branch: 
8.7.x
Introduced in version: 
8.7.0
Description: 

Views now uses hook_theme_suggestions_HOOK for supplying addition template suggestions.

This change is a preemptive move towards #2923506: Deprecate and discourage use of the "array of theme hooks" feature.

The following methods have been deprecated:

\Drupal\views\Plugin\views\ViewsPluginInterface::themeFunctions()
\Drupal\views\ViewExecutable::buildThemeFunctions()

Use the following replacements appropriately:

\Drupal\views\Plugin\views\ViewsPluginInterface::themeSuggestions()\Drupal\views\ViewExecutable::themeSuggestions()

Views Plugin Authors

While it is unlikely you will need to do this, especially if you simply extended from an existing class, please be mindful of the following changes:

Replace any Views plugin definitions of render arrays that reference the deprecated ViewsPluginInterface::themeFunctions method with the following:

-  '#theme' => $this->themeFunctions(),
+  '#theme' => $this->definition['theme'],
+  '#context' => ['plugin' => $this],

Replace any Views plugin definitions of render arrays that reference the deprecated ViewExecutable::buildThemeFunctions method:

-  '#theme' =>$this->view->buildThemeFunctions($this->groupingTheme),
+  '#theme' => $this->groupingTheme,
+  '#context' => ['view' => $this->view],

The basis of what these changes are is as follows:

  1. Replacing #theme with a single theme hook that is invoked rather than an array of theme hooks with suggestions.
  2. Providing #context to the plugin or view instance so Views' hook_theme_suggestions() implementation can intercept it and supply additional template suggestions. This last part is crutial; otherwise your plugins may not recieve the necessary suggestions and stop working.
Impacts: 
Module developers
Themers