public static function PlaceholdersTest::callback in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Render/RendererTestBase.php \Drupal\Tests\Core\Render\PlaceholdersTest::callback()
- 10 core/tests/Drupal/Tests/Core/Render/RendererTestBase.php \Drupal\Tests\Core\Render\PlaceholdersTest::callback()
#lazy_builder callback; attaches setting, generates markup.
Parameters
string $animal: An animal.
Return value
array A renderable array.
2 calls to PlaceholdersTest::callback()
- PlaceholdersTest::callbackPerUser in core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTestBase.php - #lazy_builder callback; attaches setting, generates markup, user-specific.
- PlaceholdersTest::callbackTagCurrentTemperature in core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTestBase.php - #lazy_builder callback; attaches setting, generates markup, cache tag.
File
- core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTestBase.php, line 272 - Contains \Drupal\Tests\Core\Render\RendererTestBase.
Class
Namespace
Drupal\Tests\Core\RenderCode
public static function callback($animal, $use_animal_as_array_key = FALSE) {
$value = $animal;
if ($use_animal_as_array_key) {
$value = [
$animal => TRUE,
];
}
return [
'#markup' => '<p>This is a rendered placeholder!</p>',
'#attached' => [
'drupalSettings' => [
'dynamic_animal' => $value,
],
],
];
}