-
Notifications
You must be signed in to change notification settings - Fork 4
/
VideoEmbedServiceProvider.php
47 lines (40 loc) · 1.26 KB
/
VideoEmbedServiceProvider.php
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
43
44
45
46
47
<?php
namespace Statamic\Addons\VideoEmbed;
use Statamic\Extend\ServiceProvider;
use Statamic\Extend\Meta;
class VideoEmbedServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot() {
//
}
/**
* Register the application services.
*
* @return void
*/
public function register() {
$this->app->bind('VideoEmbed.resolve-resource-path', function () {
/**
* @param string $path The filename relative to the `resources/assets` directory.
* eg. `js/foo.js`
* @param Addon $addon An instance of Statamic\Extend\Addon for your addon.
* @return string The filename relative to `resources/assets`
* eg. `js/foo.js?id=1234` or `js/foo.somehash.js`
*/
return function ($path, $addon) {
$meta = new Meta($addon);
$version = '';
if ($meta->exists()) {
$meta->load();
$version = $meta->get('version');
}
return $path . '?v=' . $version;
};
});
}
}