class TestWithHiddenSourceField

Same name and namespace in other branches
  1. 10 core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithHiddenSourceField.php \Drupal\media_test_source\Plugin\media\Source\TestWithHiddenSourceField
  2. 11.x core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithHiddenSourceField.php \Drupal\media_test_source\Plugin\media\Source\TestWithHiddenSourceField
  3. 8.9.x core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithHiddenSourceField.php \Drupal\media_test_source\Plugin\media\Source\TestWithHiddenSourceField

Provides test media source.

Plugin annotation


@MediaSource(
  id = "test_hidden_source_field",
  label = @Translation("Test source with hidden source field"),
  description = @Translation("Test media source with hidden source field."),
  allowed_field_types = {"string"},
)

Hierarchy

Expanded class hierarchy of TestWithHiddenSourceField

File

core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithHiddenSourceField.php, line 19

Namespace

Drupal\media_test_source\Plugin\media\Source
View source
class TestWithHiddenSourceField extends Test {
  
  /**
   * {@inheritdoc}
   */
  public function prepareViewDisplay(MediaTypeInterface $type, EntityViewDisplayInterface $display) {
    $display->removeComponent($this->getSourceFieldDefinition($type)
      ->getName());
  }
  
  /**
   * {@inheritdoc}
   */
  public function prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayInterface $display) {
    $display->removeComponent($this->getSourceFieldDefinition($type)
      ->getName());
  }
  
  /**
   * {@inheritdoc}
   */
  protected function getSourceFieldName() {
    return 'field_media_hidden';
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.