Skip to content
Snippets Groups Projects
Commit 41c82730 authored by Maxime Veber's avatar Maxime Veber
Browse files

Improve video item

parent df2216d1
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,13 @@ class Video implements Item ...@@ -12,7 +12,13 @@ class Video implements Item
public function getWidget() public function getWidget()
{ {
preg_match('/^https:\/\/www\.youtube\.com\/watch\?v=([A-Za-z0-9\-\_]*)&?.*/', $this->url, $matches); return '<iframe width="100%" height="400" src="//www.youtube.com/embed/' . $this->getId() . '" frameborder="0" allowfullscreen></iframe>';;
return '<iframe width="100%" height="400" src="//www.youtube.com/embed/' . $matches[1] . '" frameborder="0" allowfullscreen></iframe>';; }
public function getId()
{
preg_match('/^https:\/\/www\.youtube\.com\/watch\?v=(.*)/', $this->url, $matches);
return $matches[1];
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment