Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / media_entity / src / Plugin / MediaEntity / Type / Generic.php
1 <?php
2
3 namespace Drupal\media_entity\Plugin\MediaEntity\Type;
4
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\media_entity\MediaInterface;
7 use Drupal\media_entity\MediaTypeBase;
8
9 /**
10  * Provides generic media type.
11  *
12  * @MediaType(
13  *   id = "generic",
14  *   label = @Translation("Generic media"),
15  *   description = @Translation("Generic media type.")
16  * )
17  */
18 class Generic extends MediaTypeBase {
19
20   /**
21    * {@inheritdoc}
22    */
23   public function providedFields() {
24     return [];
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public function getField(MediaInterface $media, $name) {
31     return FALSE;
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function thumbnail(MediaInterface $media) {
38     return $this->config->get('icon_base') . '/generic.png';
39   }
40
41   /**
42    * {@inheritdoc}
43    */
44   public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
45     $form['text'] = [
46       '#type' => 'markup',
47       '#markup' => $this->t("This type provider doesn't need configuration."),
48     ];
49
50     return $form;
51   }
52
53 }