function HookOrder::setPriority
Set the priority of a listener.
Parameters
\Drupal\Core\DependencyInjection\ContainerBuilder $container: The container.
string $class: The name of the class, this is the same as the service id.
int $key: The key within the tags array of the 'kernel.event_listener' tag for the hook implementation to be changed.
int $priority: The new priority.
Return value
void
1 call to HookOrder::setPriority()
- HookOrder::changePriority in core/
lib/ Drupal/ Core/ Hook/ HookOrder.php - Change the priority of a hook implementation.
File
-
core/
lib/ Drupal/ Core/ Hook/ HookOrder.php, line 194
Class
- HookOrder
- Helper methods to set priorities of hook implementations.
Namespace
Drupal\Core\HookCode
public static function setPriority(ContainerBuilder $container, string $class, int $key, int $priority) : void {
$definition = $container->getDefinition($class);
$tags = $definition->getTags();
$tags['kernel.event_listener'][$key]['priority'] = $priority;
$definition->setTags($tags);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.