Problem/Motivation
The module does not provide schema for media.source.svg. Because of this, media bundles that use the "svg" source do not pass strict config validation.
Steps to reproduce
I'm not aware of scenarios where this produces a hard error in actual use. I ran into this in the context of writing a test for integration with this module:
<?php
declare(strict_types=1);
namespace Drupal\Tests\my_module\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\media\Traits\MediaTypeCreationTrait;
/**
* Produces a schema error.
*/
final class ReproduceSchemaErrorTest extends KernelTestBase {
use MediaTypeCreationTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'field',
'file',
'image',
'media',
'svg_image_field',
'system',
'user',
];
public function testMediaTypeCreation(): void {
$this->createMediaType('svg', [
'id' => 'svg',
'label' => 'SVG',
]);
}
}
Proposed resolution
Add config schema for media.source.svg, modeled after the schema definitions in the core Media module.
Comments
Comment #3
bvoynickComment #4
alexpottThis would be great to fix. I've been using the same schema on a client project for over a year and it works great. Nice work @bvoynick
Comment #5
alexpottI rebased the branch on top of the latest changes from 2.3.x
Comment #6
jwilson3Thanks for the review and rebase. Merge pipeline to 2.3.x in progress.
Comment #8
jwilson3Comment #9
jwilson3Comment #11
jwilson3This is now released in version 2.3.5 of SVG Image Field.
Comment #12
jwilson3This is now released in version 2.3.5 of SVG Image Field. Please check release notes.