Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / video_embed_field / src / ProviderPluginInterface.php
1 <?php
2
3 namespace Drupal\video_embed_field;
4 use Drupal\Component\Plugin\PluginInspectionInterface;
5
6 /**
7  * Providers an interface for embed providers.
8  */
9 interface ProviderPluginInterface extends PluginInspectionInterface {
10
11   /**
12    * Check if the plugin is applicable to the user input.
13    *
14    * @param string $input
15    *   User input to check if it's a URL for the given provider.
16    *
17    * @return bool
18    *   If the plugin works for the given URL.
19    */
20   public static function isApplicable($input);
21
22   /**
23    * Render a thumbnail.
24    *
25    * @param string $image_style
26    *   The quality of the thumbnail to render.
27    * @param string $link_url
28    *   Where the thumbnail should be linked to.
29    *
30    * @return array
31    *   A renderable array of a thumbnail.
32    */
33   public function renderThumbnail($image_style, $link_url);
34
35   /**
36    * Get the URL of the remote thumbnail.
37    *
38    * This is used to download the remote thumbnail and place it on the local
39    * file system so that it can be rendered with image styles. This is only
40    * called if no existing file is found for the thumbnail and should not be
41    * called unnecessarily, as it might query APIs for video thumbnail
42    * information.
43    *
44    * @return string
45    *   The URL to the remote thumbnail file.
46    */
47   public function getRemoteThumbnailUrl();
48
49   /**
50    * Get the URL to the local thumbnail.
51    *
52    * This method does not gartunee that the file will exist, only that it will
53    * be the location of the thumbnail after the download thumbnail method has
54    * been called.
55    *
56    * @return string
57    *   The URI for the local thumbnail.
58    */
59   public function getLocalThumbnailUri();
60
61   /**
62    * Download the remote thumbnail URL to the local thumbnail URI.
63    */
64   public function downloadThumbnail();
65
66   /**
67    * Render embed code.
68    *
69    * @param string $width
70    *   The width of the video player.
71    * @param string $height
72    *   The height of the video player.
73    * @param bool $autoplay
74    *   If the video should autoplay.
75    *
76    * @return mixed
77    *   A renderable array of the embed code.
78    */
79   public function renderEmbedCode($width, $height, $autoplay);
80
81   /**
82    * Get the ID of the video from user input.
83    *
84    * @param string $input
85    *   Input a user would enter into a video field.
86    *
87    * @return string
88    *   The ID in whatever format makes sense for the provider.
89    */
90   public static function getIdFromInput($input);
91
92   /**
93    * Get the name of the video.
94    *
95    * @return string
96    *   A name to represent the video for the given plugin.
97    */
98   public function getName();
99
100 }