function HookCollectorPass::addProceduralImplementation

Adds a procedural hook implementation.

Parameters

\SplFileInfo $fileinfo: The file this procedural implementation is in. (You don't say)

string $hook: The name of the hook. (Huh, right?)

string $module: The name of the module. (Truly shocking!)

string $function: The name of function implementing the hook. (Wow!)

Return value

void

1 call to HookCollectorPass::addProceduralImplementation()
HookCollectorPass::collectModuleHookImplementations in core/lib/Drupal/Core/Hook/HookCollectorPass.php
Collects procedural and Attribute hook implementations.

File

core/lib/Drupal/Core/Hook/HookCollectorPass.php, line 295

Class

HookCollectorPass
Collects and registers hook implementations.

Namespace

Drupal\Core\Hook

Code

protected function addProceduralImplementation(\SplFileInfo $fileinfo, string $hook, string $module, string $function) {
    $this->proceduralHooks[$hook][$module] = FALSE;
    if ($hook === 'hook_info') {
        $this->hookInfo[] = $function;
    }
    if ($hook === 'module_implements_alter') {
        $this->moduleImplementsAlters[] = $function;
    }
    if ($fileinfo->getExtension() !== 'module') {
        $this->includes[$function] = $fileinfo->getPathname();
    }
}

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