ServerEndpointController.php
Same filename in this branch
Same filename in other branches
Namespace
Drupal\sdc_test\ControllerFile
-
core/
modules/ system/ tests/ modules/ sdc_test/ src/ Controller/ ServerEndpointController.php
View source
<?php
declare (strict_types=1);
namespace Drupal\sdc_test\Controller;
/**
* An endpoint to serve a component during tests.
*
* @internal
*/
final class ServerEndpointController {
/**
* Render an arbitrary render array.
*/
public function renderArray() : array {
$render_array = \Drupal::state()->get('sdc_test_component', [
'#markup' => 'Set your component in state using the sdc_test_component key.',
]);
return [
'#type' => 'container',
'#cache' => [
'max-age' => 0,
],
// Magic wrapper ID to pull the HTML from.
'#attributes' => [
'id' => 'sdc-wrapper',
],
'component' => $render_array,
];
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
ServerEndpointController | An endpoint to serve a component during tests. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.