3 namespace Drupal\media_test_source\Plugin\media\Source;
5 use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
6 use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
7 use Drupal\media\MediaTypeInterface;
10 * Provides test media source.
13 * id = "test_hidden_source_field",
14 * label = @Translation("Test source with hidden source field"),
15 * description = @Translation("Test media source with hidden source field."),
16 * allowed_field_types = {"string"},
19 class TestWithHiddenSourceField extends Test {
24 public function prepareViewDisplay(MediaTypeInterface $type, EntityViewDisplayInterface $display) {
25 $display->removeComponent($this->getSourceFieldDefinition($type)->getName());
31 public function prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayInterface $display) {
32 $display->removeComponent($this->getSourceFieldDefinition($type)->getName());
38 protected function getSourceFieldName() {
39 return 'field_media_hidden';