TestWithConstraints.php

Same filename in other branches
  1. 9 core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithConstraints.php
  2. 8.9.x core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithConstraints.php
  3. 10 core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithConstraints.php

Namespace

Drupal\media_test_source\Plugin\media\Source

File

core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithConstraints.php

View source
<?php

declare (strict_types=1);
namespace Drupal\media_test_source\Plugin\media\Source;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\media\Attribute\MediaSource;
use Drupal\media\MediaSourceEntityConstraintsInterface;
use Drupal\media\MediaSourceFieldConstraintsInterface;

/**
 * Provides generic media type.
 */
class TestWithConstraints extends Test implements MediaSourceEntityConstraintsInterface, MediaSourceFieldConstraintsInterface {
    
    /**
     * {@inheritdoc}
     */
    public function getEntityConstraints() {
        return \Drupal::state()->get('media_source_test_entity_constraints', []);
    }
    
    /**
     * {@inheritdoc}
     */
    public function getSourceFieldConstraints() {
        return \Drupal::state()->get('media_source_test_field_constraints', []);
    }

}

Classes

Title Deprecated Summary
TestWithConstraints Provides generic media type.

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