Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / media / tests / modules / media_test_source / src / Plugin / media / Source / TestWithConstraints.php
1 <?php
2
3 namespace Drupal\media_test_source\Plugin\media\Source;
4
5 use Drupal\media\MediaSourceEntityConstraintsInterface;
6 use Drupal\media\MediaSourceFieldConstraintsInterface;
7
8 /**
9  * Provides generic media type.
10  *
11  * @MediaSource(
12  *   id = "test_constraints",
13  *   label = @Translation("Test source with constraints"),
14  *   description = @Translation("Test media source that provides constraints."),
15  *   allowed_field_types = {"string_long"},
16  * )
17  */
18 class TestWithConstraints extends Test implements MediaSourceEntityConstraintsInterface, MediaSourceFieldConstraintsInterface {
19
20   /**
21    * {@inheritdoc}
22    */
23   public function getEntityConstraints() {
24     return \Drupal::state()->get('media_source_test_entity_constraints', []);
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public function getSourceFieldConstraints() {
31     return \Drupal::state()->get('media_source_test_field_constraints', []);
32   }
33
34 }