Hi

I'm creating a Vzaar provider module for Video Embed Field d8. The code looks like this, and seems to work well:

<?php

namespace Drupal\video_embed_vzaar\Plugin\video_embed_field\Provider;

use Drupal\video_embed_field\ProviderPluginBase;

/**
 * A Vzaar provider plugin for video embed field.
 *
 * @VideoEmbedProvider(
 *   id = "vzaar",
 *   title = @Translation("Vzaar")
 * )
 */
class Vzaar extends ProviderPluginBase {

  /**
   * {@inheritdoc}
   */
  public function renderEmbedCode($width, $height, $autoplay) {
    $iframe = [
      '#type' => 'video_embed_iframe',
      '#provider' => 'vzaar',
      '#url' => sprintf('https://view.vzaar.com/%s/player', $this->getVideoId()),
      '#query' => [],
      '#attributes' => [
        'width' => $width,
        'height' => $height,
        'frameborder' => '0',
        'allowfullscreen' => 'allowfullscreen',
      ],
    ];
    return $iframe;
  }

  /**
   * {@inheritdoc}
   */
  public function getRemoteThumbnailUrl() {
    $url = 'https://view.vzaar.com/%s/thumb';
    return sprintf($url, $this->getVideoId());
  }

  /**
   * {@inheritdoc}
   */
  public static function getIdFromInput($input) {
    if (strpos($input, 'view.vzaar.com') !== false) {
      // e.g. https://view.vzaar.com/848450 
      $id= preg_replace('/[^0-9]/','',$input);
      return isset($id) ? $id : false;
    }
    return false;
  }
}

I would like to additionally add a download link below the embedded video player. This would simple be:
<a href="https://view.vzaar.com/848450/download">Download</a>

Could you advise how I could achieve this please?

Comments

Matt B created an issue. See original summary.

Sam152’s picture

I would write a new field formatter for this and place the extra download link in there.

Sam152’s picture

Status: Active » Closed (won't fix)

With the advent of Media in core, the Video Embed Field module has moved to being minimally maintained. Only issues which assist in the migration to Media in core will be committed. To read more about this decision, please see: #3089599: Maintenance status for Video Embed Field now that media is in core.