da282f70d3a4cef08cd17e4f444edf935cf54781
[yaffs-website] / web / modules / contrib / video_embed_field / tests / modules / video_embed_field_mock_provider / src / Plugin / video_embed_field / Provider / MockProvider.php
1 <?php
2
3 namespace Drupal\video_embed_field_mock_provider\Plugin\video_embed_field\Provider;
4
5 use Drupal\video_embed_field\ProviderPluginInterface;
6
7 /**
8  * A mock video provider for use in tests.
9  *
10  * @VideoEmbedProvider(
11  *   id = "mock",
12  *   title = @Translation("Mock Provider")
13  * )
14  */
15 class MockProvider implements ProviderPluginInterface {
16
17   /**
18    * {@inheritdoc}
19    */
20   public static function isApplicable($input) {
21     return strpos($input, 'example.com') !== FALSE;
22   }
23
24   /**
25    * {@inheritdoc}
26    */
27   public function renderThumbnail($image_style, $link_url) {
28     return [
29       '#markup' => 'Mock provider thumbnail.',
30     ];
31   }
32
33   /**
34    * {@inheritdoc}
35    */
36   public function renderEmbedCode($width, $height, $autoplay) {
37     return [
38       '#markup' => 'Mock provider embed code.',
39     ];
40   }
41
42   /**
43    * {@inheritdoc}
44    */
45   public function getRemoteThumbnailUrl() {
46     return '';
47   }
48
49   /**
50    * {@inheritdoc}
51    */
52   public function getLocalThumbnailUri() {
53     return '';
54   }
55
56   /**
57    * {@inheritdoc}
58    */
59   public function downloadThumbnail() {
60     return TRUE;
61   }
62
63   /**
64    * {@inheritdoc}
65    */
66   public static function getIdFromInput($input) {
67     return $input;
68   }
69
70   /**
71    * {@inheritdoc}
72    */
73   public function getName() {
74     return 'Video Name';
75   }
76
77   /**
78    * {@inheritdoc}
79    */
80   public function getPluginId() {
81     return 'foo';
82   }
83
84   /**
85    * {@inheritdoc}
86    */
87   public function getPluginDefinition() {
88     return [];
89   }
90
91 }