Skip to content

maxackerman/kirby-vimeo-asset-urls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kirby Plugin: Get Vimeo Asset URLs

This requires a paid Vimeo account

Setup app with Vimeo here

Add vimeo credentials to Kirby config:

# /site/config/config.php

<?php

return [
  'violetoffice.vimeoassets.client_id' => 'XXXXX',
  'violetoffice.vimeoassets.client_secrets' => 'XXXXX',
  'violetoffice.vimeoassets.token' => 'XXXXX',
];

Add a video field to a file blueprint:

# /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

Using the the data your templates:

<?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 ?>

TODO

  • make field names a config option
  • error / success notifications

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages