Version 1
[yaffs-website] / web / modules / contrib / media_entity / src / Plugin / MediaEntity / Type / Generic.php
diff --git a/web/modules/contrib/media_entity/src/Plugin/MediaEntity/Type/Generic.php b/web/modules/contrib/media_entity/src/Plugin/MediaEntity/Type/Generic.php
new file mode 100644 (file)
index 0000000..b83ba9d
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+namespace Drupal\media_entity\Plugin\MediaEntity\Type;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\media_entity\MediaInterface;
+use Drupal\media_entity\MediaTypeBase;
+
+/**
+ * Provides generic media type.
+ *
+ * @MediaType(
+ *   id = "generic",
+ *   label = @Translation("Generic media"),
+ *   description = @Translation("Generic media type.")
+ * )
+ */
+class Generic extends MediaTypeBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providedFields() {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getField(MediaInterface $media, $name) {
+    return FALSE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function thumbnail(MediaInterface $media) {
+    return $this->config->get('icon_base') . '/generic.png';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+    $form['text'] = [
+      '#type' => 'markup',
+      '#markup' => $this->t("This type provider doesn't need configuration."),
+    ];
+
+    return $form;
+  }
+
+}