violetoffice / vimeoassets
使用Vimeo API获取Vimeo资产URL的Kirby插件
v0.1.2
2020-11-03 22:31 UTC
Requires
- getkirby/composer-installer: ^1.1
- vimeo/vimeo-api: ^3.0
This package is auto-updated.
Last update: 2024-09-19 23:30:06 UTC
README
这需要一个付费的Vimeo账户
在此处设置带有Vimeo的应用 这里
将Vimeo凭证添加到Kirby配置中
# /site/config/config.php
<?php
return [
'violetoffice.vimeoassets.client_id' => 'XXXXX',
'violetoffice.vimeoassets.client_secrets' => 'XXXXX',
'violetoffice.vimeoassets.token' => 'XXXXX',
];
将视频字段添加到文件蓝图
# /site/blueprints/files/image.yml
title: Example Image/Video
fields:
haspostervideo:
label: Include autoplay poster video?
type: toggle
default: false
text:
- 'no'
- 'yes'
postervimeourl:
label: Vimeo URL
type: url
placeholder: https://vimeo.com/37776933
when:
haspostervideo: true
在模板中使用数据
<?php $item->postervimeo() = $vimeodata ?>
<?php foreach($vimeodata->toStructure() as $file): ?>
type: <?= $file->type() ?><br />
quality: <?= $file->quality() ?><br />
link: <?= $file->link() ?><br />
<?php e($file->width() != '', 'width:' . $file->width()) ?>
<hr>
<?php endforeach ?>
待办事项
- 使字段名称成为配置选项
- 错误/成功通知