class BigPipeMessagesHooks
Hook implementations for big_pipe_test.
Hierarchy
- class \Drupal\big_pipe_messages_test\Hook\BigPipeMessagesHooks
Expanded class hierarchy of BigPipeMessagesHooks
File
-
core/
modules/ big_pipe/ tests/ modules/ big_pipe_messages_test/ src/ Hook/ BigPipeMessagesHooks.php, line 13
Namespace
Drupal\big_pipe_messages_test\HookView source
class BigPipeMessagesHooks {
/**
* Implements hook_element_info_alter().
*/
public function elementInfoAlter(array &$info) : void {
$info['status_messages']['#pre_render'][] = static::class . '::preRenderMessages';
}
/**
* Pre render callback.
*
* Removes #placeholder_strategy from the messages element to force the
* messages placeholder to go via the big pipe strategy for testing purposes.
*/
public static function preRenderMessages(array $element) : array {
if (isset($element['#attached']['placeholders'])) {
$key = key($element['#attached']['placeholders']);
unset($element['#attached']['placeholders'][$key]['#placeholder_strategy_denylist']);
}
if (isset($element['messages']['#attached']['placeholders'])) {
$key = key($element['messages']['#attached']['placeholders']);
unset($element['messages']['#attached']['placeholders'][$key]['#placeholder_strategy_denylist']);
}
return $element;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
BigPipeMessagesHooks::elementInfoAlter | public | function | Implements hook_element_info_alter(). |
BigPipeMessagesHooks::preRenderMessages | public static | function | Pre render callback. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.