function ThemeManagerInterface::invokeAllWith

Executes a callback for each implementation of a hook for a theme.

It will detect the currently active theme and invoke the given hook for the active theme and all of its base themes in reverse order.

The callback is passed two arguments, a closure which executes a hook implementation and the machine name of the current theme. Note that this is executed for just a single theme and its base themes.

Parameters

string $hook: The name of the hook to invoke.

callable(callable, string): mixed $callback: A callable that invokes a hook implementation. Such that $callback is callable(callable, string): mixed. Arguments:

  • Closure to a hook implementation.
  • Implementation theme machine name.
1 method overrides ThemeManagerInterface::invokeAllWith()
ThemeManager::invokeAllWith in core/lib/Drupal/Core/Theme/ThemeManager.php
Executes a callback for each implementation of a hook for a theme.

File

core/lib/Drupal/Core/Theme/ThemeManagerInterface.php, line 108

Class

ThemeManagerInterface
Provides a high level access to the active theme and methods to use it.

Namespace

Drupal\Core\Theme

Code

public function invokeAllWith(string $hook, callable $callback) : void;

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.