如何渲染字符串html
我有自定义块,其中包含以下代码。
foreach ($video_result as $video){
$title = $video->title;
$video_body = $video->body_value;
}
var_dump($video_body);
$renderable = [
'#theme' => 'video-block',
'#title' => $title,
'#description' => $video_body
];
return $renderable;
这返回到 twig 文件,例如
<h6>Title {{ title }}</h6>
{{ description | raw}}
我在浏览器上以 html 形式输出,当我检查它时,我看到 html 用双引号引起来。我必须在浏览器上将其呈现为视频。我在这里做错了什么
I have custom block which has following code.
foreach ($video_result as $video){
$title = $video->title;
$video_body = $video->body_value;
}
var_dump($video_body);
$renderable = [
'#theme' => 'video-block',
'#title' => $title,
'#description' => $video_body
];
return $renderable;
And this return to twig file such as
<h6>Title {{ title }}</h6>
{{ description | raw}}
I get output as html on browser and when i inspect it i see html is wrap with double quotes. I have to render it as video on browser. What i am doing wrong here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这样的事情
{!! $描述!!}
Try Something Like This
{!! $description !!}