TestHookRemove.php
Namespace
Drupal\hook_test_remove\HookFile
-
core/
modules/ system/ tests/ modules/ hook_test_remove/ src/ Hook/ TestHookRemove.php
View source
<?php
declare (strict_types=1);
namespace Drupal\hook_test_remove\Hook;
use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\Hook\Attribute\RemoveHook;
/**
* Add a hook here, then remove it with another attribute.
*/
class TestHookRemove {
/**
* This hook should not be run because the next hook replaces it.
*/
public function hookDoNotRun() : string {
// This hook should not run.
return __METHOD__;
}
/**
* This hook should run and prevent custom_hook1.
*/
public function hookDoRun() : string {
// This hook should run.
return __METHOD__;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
TestHookRemove | Add a hook here, then remove it with another attribute. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.