Skip to content

Commit 7171f7e

Browse files
committed
Initial commit
0 parents  commit 7171f7e

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

BootstrapVideoEmbedTags.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Statamic\Addons\BootstrapVideoEmbed;
4+
5+
use Statamic\Extend\Tags;
6+
7+
class BootstrapVideoEmbedTags extends Tags
8+
{
9+
/**
10+
* The {{ bootstrap_video_embed }} tag
11+
*
12+
* @return string|array
13+
*/
14+
public function index()
15+
{
16+
$value = $this->getParam('src');
17+
$height = $this->getParam('height');
18+
$width = $this->getParam('width');
19+
$autoplay = $this->getParam('autoplay', null);
20+
$loop = $this->getParam('loop', null);
21+
$api = $this->getParam('api', null);
22+
$showinfo = $this->getParam('showinfo', null);
23+
$controls = $this->getParam('controls', null);
24+
25+
$aspect_ratio = $this->api('VideoEmbed')->getAspectRatio($height, $width);
26+
$src = $this->api('VideoEmbed')->getVideoSrc($value, $autoplay, $loop, $api, $showinfo, $controls);
27+
28+
if ($aspect_ratio == 'cinema' || $aspect_ratio == 'wide' || $aspect_ratio == 'clasic')
29+
{
30+
$aspect_ratio_class = 'embed-responsive-16by9';
31+
}
32+
else
33+
{
34+
$aspect_ratio_class = 'embed-responsive-4by3';
35+
}
36+
37+
return '<div class="embed-responsive ' . $aspect_ratio_class . '"><iframe class="embed-responsive-item" src="' . $src . '"></iframe></div>';
38+
}
39+
}

license.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 JRC9 Design Studio
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10+

meta.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: BootstrapVideoEmbed
2+
version: 1.0.0
3+
description: A tag that outputs your video embeds in the Bootstrap responsive format.
4+
url: https://github.com/jrc9designstudio/statamic-bootstrap-video-embed
5+
developer: JRC9 Design Studio
6+
developer_url: https://jrc9.ca

readme.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Bootstrap Video Embed for Statamic 2
2+
*Requirements:* Statamic v2.x, Statamic Video Embed v2.x
3+
*Version:* 1.0.0
4+
5+
### What is this?
6+
A tag that adds your video including the Bootstrap Responsive Embed Tags.
7+
8+
### Installation
9+
- Install and configure [Statamic Video Embed](https://github.com/jrc9designstudio/statamic-video-embed).
10+
- Rename the folder `BootstrapVideoEmbed` and copy it to your `site/addons` folder.
11+
12+
### Tag
13+
- Assuming your video embed field is `video`.
14+
```
15+
{{ bootstrap_video_embed src='{video:url}' height='{video:height}' width='{video:width}' }}
16+
```
17+
- If you want to overide the default settings (from the Video Embed addon).
18+
```
19+
{{ bootstrap_video_embed src='{video:url}' height='{video:height}' width='{video:width}' autoplay='true' loop='true' api='true' showinfo='false' controls='false' }}
20+
```

0 commit comments

Comments
 (0)