Problem/Motivation

SophronMimeTypeMapFactory extends MimeTypeMapFactory and overrides the ::create() method. However, this could be changed upstream and changes would need to be duplicated.

Instead it should override the \Drupal\Core\File\MimeType\MimeTypeMapFactory::doCreateMap() method.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork sophron-3519605

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kim.pepper created an issue. See original summary.

mondrake made their first commit to this issue’s fork.

mondrake’s picture

Status: Active » Needs review

Good point, thanks @kim.pepper

mondrake’s picture

I think we should add a test to check if DummyMimeTypeMapLoadedSubscriber has an effect on the mapping. The legacy hook was already not processed by Sophron, but now that we have an API we should be able to process the event. This event will trigger 'core' changes, while the Sophron's initializeMap will be specific to Sophron.

In essence, the sequence should be:
a) the Sophron map is initialized in the Drupal\sophron\MimeMapManagerInterface service, initializeMap event is triggered and will process map changes according to fileeye/mimemap primitives;
b) core triggers the MimeTypeMapLoadedEvent event in MimeTypeMapFactory and will process map changes according to MimeTypeMap primitives (that are proxies to the fileeye/mimemap ones via Sophron's MimeMapManager).

A bit complicated but this would allow keeping Sophron as a separate MIME type mapping service not used for guessing purposes.

mondrake’s picture

mondrake’s picture

mondrake’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.