function Test::getMetadataAttributes
Same name in other branches
- 8.9.x core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php \Drupal\media_test_source\Plugin\media\Source\Test::getMetadataAttributes()
- 10 core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php \Drupal\media_test_source\Plugin\media\Source\Test::getMetadataAttributes()
- 11.x core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php \Drupal\media_test_source\Plugin\media\Source\Test::getMetadataAttributes()
Overrides MediaSourceInterface::getMetadataAttributes
File
-
core/
modules/ media/ tests/ modules/ media_test_source/ src/ Plugin/ media/ Source/ Test.php, line 25
Class
- Test
- Provides test media source.
Namespace
Drupal\media_test_source\Plugin\media\SourceCode
public function getMetadataAttributes() {
// The metadata attributes are kept in state storage. This allows tests to
// change the metadata attributes and makes it easier to test different
// variations.
$attributes = \Drupal::state()->get('media_source_test_attributes', [
'attribute_1' => [
'label' => $this->t('Attribute 1'),
'value' => 'Value 1',
],
'attribute_2' => [
'label' => $this->t('Attribute 2'),
'value' => 'Value 1',
],
]);
return array_map(function ($item) {
return $item['label'];
}, $attributes);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.