Skip to content
Snippets Groups Projects
Commit 5bde1104 authored by Dieter Holvoet's avatar Dieter Holvoet Committed by mondrake
Browse files

Issue #3331098 by DieterHolvoet: Fix subclassing and stop overriding constructors

parent f635ed48
No related branches found
No related tags found
No related merge requests found
......@@ -2,13 +2,8 @@
namespace Drupal\file_mdm_exif\Plugin\FileMetadata;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Drupal\file_mdm\Plugin\FileMetadata\FileMetadataPluginBase;
use Drupal\file_mdm_exif\ExifTagMapperInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Mime\MimeTypeGuesserInterface;
use lsolesen\pel\PelEntry;
use lsolesen\pel\PelExif;
use lsolesen\pel\PelIfd;
......@@ -47,46 +42,15 @@ class Exif extends FileMetadataPluginBase {
*/
protected $pelFile;
/**
* Constructs an Exif file metadata plugin.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param array $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_service
* The cache service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mime_type_guesser
* The MIME type mapping service.
* @param \Drupal\file_mdm_exif\ExifTagMapperInterface $tag_mapper
* The EXIF tag mapping service.
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
* The stream wrapper manager service.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, CacheBackendInterface $cache_service, ConfigFactoryInterface $config_factory, MimeTypeGuesserInterface $mime_type_guesser, ExifTagMapperInterface $tag_mapper, StreamWrapperManagerInterface $stream_wrapper_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $cache_service, $config_factory, $stream_wrapper_manager);
$this->mimeTypeGuesser = $mime_type_guesser;
$this->tagMapper = $tag_mapper;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('cache.file_mdm'),
$container->get('config.factory'),
$container->get('file.mime_type.guesser'),
$container->get('file_mdm_exif.tag_mapper'),
$container->get('stream_wrapper_manager')
);
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$instance->mimeTypeGuesser = $container->get('file.mime_type.guesser');
$instance->tagMapper = $container->get('file_mdm_exif.tag_mapper');
return $instance;
}
/**
......
......@@ -108,7 +108,7 @@ abstract class FileMetadataPluginBase extends PluginBase implements FileMetadata
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
* The stream wrapper manager service.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, CacheBackendInterface $cache_service, ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager) {
public final function __construct(array $configuration, $plugin_id, array $plugin_definition, CacheBackendInterface $cache_service, ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->cache = $cache_service;
$this->configFactory = $config_factory;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment