How to render youtube video in YII2 DetailView widget -


i'm displaying you-tube video on front end of website. admin can provide you-tube source embedded code site end. want have preview on view page. following code tried displaying iframe tags (i know not right way)

[     'attribute'=>'source',     'value' => !empty($model->source) ? '<iframe class="embed-responsive-item" src="'.$model->source.'" frameborder="0" allowfullscreen></iframe>' : null, ], 

is there thing has image format:

[     'label'=>'image',     'attribute'=>'userinfo.image',     'format' => ['image',['width'=>'100','height'=>'100']], ], 

format html or raw you.

[     'format' => 'raw',     'attribute'=>'source',     'value' => !empty($model->source) ? '<iframe class="embed-responsive-item" src="'.$model->source.'" frameborder="0" allowfullscreen></iframe>' : null, ], 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -