You are here

public function DescriptionTemplateTrait::description in Popup 8

Generate a render array with our templated content.

Return value

array A render array.

File

src/Utility/DescriptionTemplateTrait.php, line 34

Class

DescriptionTemplateTrait
Trait to implement a "drop-in" template for Example's controllers.

Namespace

Drupal\popup\Utility

Code

public function description() {
  $template_path = $this
    ->getDescriptionTemplatePath();
  $template = file_get_contents($template_path);
  $build = [
    'description' => [
      '#type' => 'inline_template',
      '#template' => $template,
      '#context' => $this
        ->getDescriptionVariables(),
    ],
  ];
  return $build;
}