Customize Vimeo Embeds

Hi!

I am searching for a clean solution to embed a Vimeo Clip without the titles, without the byline and a custom color.

The share button on vimeo generates this code:
<iframe src="https://player.vimeo.com/video/22775048?color=2dac96&title=0&byline=0&portrait=0" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

I know I could somehow change the embed.php Kirby Core File - but is there a cleaner way of doing this?

Thanks,
M

You can overwrite the vimeo Kirbytag in a plugin file (like site/plugins/vimeo/vimeo.php):

kirbytext::$tags['vimeo'] = array(
  'attr' => array(
    'width',
    'height',
    'class',
    'caption'
  ),
  'html' => function($tag) {

    $caption = $tag->attr('caption');

    if(!empty($caption)) {
      $figcaption = '<figcaption>' . escape::html($caption) . '</figcaption>';
    } else {
      $figcaption = null;
    }

    return '<figure class="' . $tag->attr('class', kirby()->option('kirbytext.video.class', 'video')) . '">' . YOUREMBEDCODE . $figcaption . '</figure>';

  }
);

Thanks for the quick answer! I give it a try!

I tried it and it works with Kirbtext embeds, but I asked the wrong question - sorry.

I am using the Template helper.

<?php
$videolink = $page->reel()->text();
?>

<div class="videocontainer">
   <?php echo vimeo($videolink) ?>
</div>

The User provides the Vimeo URL in the panel.

Well, then it’s even easier: Simply put your iframe code right there instead of using the helper. :slight_smile:

Ha, thanks. :grinning:

I already thought about that, but i would like to give the client the possibility to change the URL himself in the panel. Thats why I am using the $videolink…

Yes, but you can put the iframe code into the template and make the src attribute dynamic by putting in the link from the link field.

Wow - sometimes I just think to complicated. Thanks