-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c46390
commit adf4906
Showing
7 changed files
with
178 additions
and
24,252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Requirements | ||
|
||
## Craft CMS | ||
Videos requires Craft CMS 3.5.0 and above. | ||
Videos requires Craft CMS 3.5.0 or later. | ||
|
||
## PHP | ||
Videos requires PHP 7.0 and above. | ||
Videos requires PHP 7.2.5 or later. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Template Variables | ||
|
||
## craft.videos.getEmbed(videoUrl, embedOptions = []) | ||
|
||
Returns the embed code for a video. | ||
|
||
- `videoUrl`: The URL of the video to embed. (Required) | ||
- `embedOptions`: An array of options to pass to the embed. | ||
|
||
```twig | ||
{% set videoEmbed = craft.videos.getEmbed('https://www.youtube.com/watch?v=-Oox2w5sMcA', ['width' => '100%']) %} | ||
{{ videoEmbed }} | ||
``` | ||
|
||
## craft.videos.getVideoByUrl(videoUrl, enableCache = true, cacheExpiry = 3600) | ||
|
||
Retrieve a video from its URL. | ||
|
||
- `videoUrl`: The URL of the video to embed. (Required) | ||
- `enableCache`: Whether to enable caching. (Default: true) | ||
- `cacheExpiry`: The number of seconds to cache the video. (Default: 3600) | ||
|
||
```twig | ||
{% set video = craft.videos.getVideoByUrl('https://www.youtube.com/watch?v=-Oox2w5sMcA') %} | ||
{% if video %} | ||
{% if not video.hasErrors('url') %} | ||
<ul> | ||
<li>title: {{ video.title }}</li> | ||
<li>url: {{ video.url }}</li> | ||
<li>embed: {{ video.embed({ width: 300, height: 200 }) }}</li> | ||
</ul> | ||
{% else %} | ||
<p>Video has errors:</p> | ||
<ul> | ||
{% for error in video.getErrors('url') %} | ||
<li>{{ error }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{% else %} | ||
<p>No video.</p> | ||
{% endinf %} | ||
``` | ||
|
||
## craft.videos.url(videoUrl, enableCache = true, cacheExpiry = 3600) | ||
|
||
Alias for [craft.videos.getVideoByUrl()](#craft-videos-getvideobyurl-videourl-enablecache-true-cacheexpiry-3600). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Updating Instructions | ||
|
||
Videos may be updated like any other update to Craft or its plugins. | ||
|
||
## Updating from the Control Panel | ||
|
||
When an update is available, users with permission to update Craft will see a badge in the control panel next to **Utilities** in the main navigation. | ||
|
||
From **Utilities → Updates**, any available Videos updates will be listed along with those for Craft and other plugins. Choose “Videos” to view the release notes before updating. | ||
|
||
Always check the release notes for any changes that may impact your site. Any critical changes will be clearly identified at the top. | ||
|
||
You can then choose the **Update** button next to Videos to update the plugin, or **Update All** to run all available plugin updates. | ||
|
||
## Updating from the Terminal | ||
|
||
The [`update` console command](https://craftcms.com/docs/3.x/console-commands.html#update) can be used to update Craft and plugins including Videos. | ||
|
||
To see available updates, go to your Craft project in your terminal and run this command: | ||
|
||
```bash | ||
php craft update | ||
``` | ||
|
||
If a Videos update is available, run this command to apply it: | ||
|
||
```bash | ||
php craft update videos | ||
``` | ||
|
||
To update to a specific version of Videos, run this command: | ||
|
||
```bash | ||
php craft update videos:2.1.0 | ||
``` | ||
|
||
## Updating from Videos 2.0 to 2.1 | ||
|
||
The Videos 2.1 introduced some breaking changes. | ||
If you’re upgrading from 2.0, you’ll need to update your templates to reflect these changes. | ||
|
||
### Video model | ||
|
||
If there are errors when trying to retrieve the video, they are now attached to the video model, on the URL attribute: | ||
|
||
```twig | ||
{% if video.hasErrors('url') %} | ||
<p>Video has errors:</p> | ||
<ul> | ||
{% for error in video.getErrors('url') %} | ||
<li>{{ error }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
``` | ||
|
||
### Video field | ||
|
||
Before: | ||
|
||
```twig | ||
{% set video = entry.video %} | ||
{% if video %} | ||
<ul> | ||
<li>title: {{ video.title }}</li> | ||
<li>url: {{ video.url }}</li> | ||
<li>embed: {{ video.embed({ width: 300, height: 200 }) }}</li> | ||
</ul> | ||
{% endinf %} | ||
``` | ||
|
||
After: | ||
|
||
```twig | ||
{% set video = entry.video %} | ||
{% if video %} | ||
{% if not video.hasErrors('url') %} | ||
<ul> | ||
<li>title: {{ video.title }}</li> | ||
<li>url: {{ video.url }}</li> | ||
<li>embed: {{ video.embed({ width: 300, height: 200 }) }}</li> | ||
</ul> | ||
{% else %} | ||
<p>Video has errors:</p> | ||
<ul> | ||
{% for error in video.getErrors('url') %} | ||
<li>{{ error }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{% else %} | ||
<p>No video.</p> | ||
{% endinf %} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.