TestHookInvoke.php
Same filename and directory in other branches
Namespace
Drupal\hook_single_invoke\HookFile
-
core/
modules/ system/ tests/ modules/ hook_single_invoke/ src/ Hook/ TestHookInvoke.php
View source
<?php
declare (strict_types=1);
namespace Drupal\hook_single_invoke\Hook;
use Drupal\Core\Hook\Attribute\Hook;
/**
* Add four hook implementations for two hooks, one returns arrays one string.
*/
class TestHookInvoke {
/**
* This hook returns an array.
*/
public function hookInvokeSingleArrayOne() : array {
return [
__METHOD__,
];
}
/**
* This hook returns an array.
*/
public function hookInvokeSingleArrayTwo() : array {
return [
__METHOD__,
];
}
/**
* This hook returns an ArrayObject.
*
* @return \ArrayObject< int, string >
* ArrayObject of the method.
*/
public function hookInvokeSingleArrayObjectOne() : \ArrayObject {
return new \ArrayObject([
__METHOD__,
]);
}
/**
* This hook returns an ArrayObject.
*
* @return \ArrayObject< int, string >
* ArrayObject of the method.
*/
public function hookInvokeSingleArrayObjectTwo() : \ArrayObject {
return new \ArrayObject([
__METHOD__,
]);
}
/**
* This hook returns a string.
*/
public function hookInvokeSingleStringOne() : string {
return __METHOD__;
}
/**
* This hook returns a string.
*/
public function hookInvokeSingleStringTwo() : string {
return __METHOD__;
}
/**
* This hook returns a stdClass.
*/
public function hookInvokeSingleClassOne() : \stdClass {
return new \stdClass();
}
/**
* This hook returns a stdClass.
*/
public function hookInvokeSingleClassTwo() : \stdClass {
return new \stdClass();
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| TestHookInvoke | Add four hook implementations for two hooks, one returns arrays one string. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.