function TestXssBlock::build
Same name and namespace in other branches
- 11.x core/modules/block/tests/modules/block_test/src/Plugin/Block/TestXssBlock.php \Drupal\block_test\Plugin\Block\TestXssBlock::build()
File
-
core/
modules/ block/ tests/ modules/ block_test/ src/ Plugin/ Block/ TestXssBlock.php, line 25
Class
- TestXssBlock
- Provides a block containing an XSS payload.
Namespace
Drupal\block_test\Plugin\BlockCode
public function build() : array {
$payload = '<img src=x onerror="window.XSS = true;">';
return [
'#markup' => Markup::create('<input class="block-filter-text" data-element="' . Html::escape($payload) . '">'),
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.