Change record status: 
Project: 
Introduced in branch: 
11.4.x
Introduced in version: 
11.4.0
Description: 

\Drupal\views\ViewExecutable::getHandler() has been renamed to
\Drupal\views\ViewExecutable::getHandlerConfiguration(). The old method is
deprecated and will be removed in Drupal 13.

The old name was misleading: despite its name, the method does not return a handler
plugin instance — it returns the stored configuration array of a handler on a
given display. This was easily confused with
\Drupal\views\Plugin\views\display\DisplayPluginBase::getHandler(), which
does return an actual handler plugin object. The new name makes the distinction clear.
The behavior and signature of the method are unchanged; only the name is different.

Before:

$configuration = $view->getHandler('page_1', 'field', 'title');

After:

$configuration = $view->getHandlerConfiguration('page_1', 'field', 'title');

Calling ViewExecutable::getHandler() still works but now triggers a
deprecation error:

Drupal\views\ViewExecutable::getHandler() is deprecated in drupal:11.4.0 and is removed
from drupal:13.0.0. Use self::getHandlerConfiguration() instead.

Note that the related methods are not affected by this change:

  • ViewExecutable::getHandlers() — still returns all handler configurations of a type on a display.
  • ViewExecutable::setHandler() / setHandlerOption() / removeHandler() — unchanged.
  • DisplayPluginBase::getHandler() — unchanged; this one returns a handler plugin instance.
Impacts: 
Module developers