function AjaxTestController::getRenderTypes
Same name in other branches
- 9 core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php \Drupal\ajax_test\Controller\AjaxTestController::getRenderTypes()
- 8.9.x core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php \Drupal\ajax_test\Controller\AjaxTestController::getRenderTypes()
- 10 core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php \Drupal\ajax_test\Controller\AjaxTestController::getRenderTypes()
Render types.
Return value
array Render types.
2 calls to AjaxTestController::getRenderTypes()
- AjaxTestController::insertLinksBlockWrapper in core/
modules/ system/ tests/ modules/ ajax_test/ src/ Controller/ AjaxTestController.php - Returns a render array of links that directly Drupal.ajax().
- AjaxTestController::insertLinksInlineWrapper in core/
modules/ system/ tests/ modules/ ajax_test/ src/ Controller/ AjaxTestController.php - Returns a render array of links that directly Drupal.ajax().
File
-
core/
modules/ system/ tests/ modules/ ajax_test/ src/ Controller/ AjaxTestController.php, line 327
Class
- AjaxTestController
- Provides content for dialog tests.
Namespace
Drupal\ajax_test\ControllerCode
protected function getRenderTypes() {
$render_single_root = [
'pre-wrapped-div' => '<div class="pre-wrapped">pre-wrapped<script> var test;</script></div>',
'pre-wrapped-span' => '<span class="pre-wrapped">pre-wrapped<script> var test;</script></span>',
'pre-wrapped-whitespace' => ' <div class="pre-wrapped-whitespace">pre-wrapped-whitespace</div>' . "\r\n",
'not-wrapped' => 'not-wrapped',
'comment-string-not-wrapped' => '<!-- COMMENT -->comment-string-not-wrapped',
'comment-not-wrapped' => '<!-- COMMENT --><div class="comment-not-wrapped">comment-not-wrapped</div>',
'svg' => '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><rect x="0" y="0" height="10" width="10" fill="green"></rect></svg>',
'empty' => '',
];
$render_multiple_root = [
'mixed' => ' foo <!-- COMMENT --> foo bar<div class="a class"><p>some string</p></div> additional not wrapped strings, <!-- ANOTHER COMMENT --> <p>final string</p>',
'top-level-only' => '<div>element #1</div><div>element #2</div>',
'top-level-only-pre-whitespace' => ' <div>element #1</div><div>element #2</div> ',
'top-level-only-middle-whitespace-span' => '<span>element #1</span> <span>element #2</span>',
'top-level-only-middle-whitespace-div' => '<div>element #1</div> <div>element #2</div>',
];
$render_info = [];
foreach ($render_single_root as $key => $render) {
$render_info[$key] = [
'render' => $render,
'effect' => 'fade',
];
}
foreach ($render_multiple_root as $key => $render) {
$render_info[$key] = [
'render' => $render,
'effect' => 'none',
];
$render_info["{$key}--effect"] = [
'render' => $render,
'effect' => 'fade',
];
}
return $render_info;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.