-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathVideoEmbedModifier.php
More file actions
executable file
·42 lines (36 loc) · 1.02 KB
/
VideoEmbedModifier.php
File metadata and controls
executable file
·42 lines (36 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Statamic\Addons\VideoEmbed;
use Statamic\Extend\Modifier;
class VideoEmbedModifier extends Modifier
{
private $videoembed;
protected function init()
{
$this->videoembed = new VideoEmbed;
}
public function index($value, $params, $context)
{
if (count($params) > 0)
{
switch ($params[0])
{
case 'link':
return $this->videoembed->getVideoLink($value);
break;
case 'video_id':
return $this->videoembed->getVideoId($value);
break;
case 'is_valid':
return $this->videoembed->isValid($value);
break;
case 'is_youtube':
return $this->videoembed->isYouTube($value);
break;
case 'is_vimeo':
return $this->videoembed->isVimeo($value);
break;
}
}
return $this->videoembed->getVideoSrc($value, null, null, null, null, null);
}
}