You are here

class RenderDeprecationController in Drupal 9

Hierarchy

  • class \Drupal\render_deprecation\RenderDeprecationController implements \Symfony\Component\DependencyInjection\ContainerAwareInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait

Expanded class hierarchy of RenderDeprecationController

File

core/modules/system/tests/modules/render_deprecation/src/RenderDeprecationController.php, line 9

Namespace

Drupal\render_deprecation
View source
class RenderDeprecationController implements ContainerAwareInterface {
  use ContainerAwareTrait;
  protected function renderArray() {
    return [
      'div' => [
        '#type' => 'container',
        '#attributes' => [
          'id' => 'render-deprecation-test-result',
        ],
        'info' => [
          '#markup' => 'Hello.',
        ],
      ],
    ];
  }
  public function buildRenderFunction() {
    $build = $this
      ->renderArray();
    $render = render($build);
    return Response::create($render);
  }
  public function buildRenderService() {
    $build = $this
      ->renderArray();
    $render = $this->container
      ->get('renderer')
      ->render($build);
    return Response::create($render);
  }

}

Members