Controller könnte so aussehen:
<?php
namespace Drupal\my_custom_module\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\node\NodeInterface;
use Drupal\node\Entity;
use Drupal\node\Entity\Node;
use Drupal\file\Entity\File;
/**
* Class MyTestController.
*/
class MyTestController extends ControllerBase {
public function main(){
$my_html = '
<p>Some <i>HTML</i> Code</p>
';
return [
'#type' => 'inline_template',
'#template' => '{{ myvar1|raw }}',
'#context' => [
'myvar1' => $my_html
]
];
}
}
Neuen Kommentar schreiben