Skip to content
Snippets Groups Projects
Commit bab3dc80 authored by Alina Basarabeanu's avatar Alina Basarabeanu Committed by Youri van Koppen
Browse files

Issue #3136615 by Alina Basarabeanu, MegaChriz, Sahana _N, jcnventura,...

Issue #3136615 by Alina Basarabeanu, MegaChriz, Sahana _N, jcnventura, andypost, joelpittet: Removed deprecated FeedsAnnotationFactory class.
parent 9b60a9bd
Branches
Tags
1 merge request!138Resolve #3136615 "Remove deprecated feedsannotationfactory"
Pipeline #214750 passed with warnings
<?php
namespace Drupal\feeds\Plugin\Type;
use Drupal\Core\Plugin\Factory\ContainerFactory;
/**
* Plugin factory which uses the plugin definition to find arguments.
*
* @deprecated in feeds:8.x-3.0-alpha6 and is removed from feeds:8.x-3.0. Implement \Drupal\Core\Plugin\ContainerFactoryPluginInterface instead.
* @see https://www.drupal.org/project/feeds/issues/3136615
*/
class FeedsAnnotationFactory extends ContainerFactory {
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = []) {
$definition = $this->discovery->getDefinition($plugin_id);
if (empty($definition['arguments'])) {
return parent::createInstance($plugin_id, $configuration);
}
@trigger_error('FeedsAnnotationFactory is deprecated in feeds:8.x-3.0-alpha6 and will be removed in feeds:8.x-3.0. Implement \Drupal\Core\Plugin\ContainerFactoryPluginInterface instead. See https://www.drupal.org/project/feeds/issues/3136615', E_USER_DEPRECATED);
// Find arguments from the annotation.
$arguments = [$configuration, $plugin_id, $definition];
foreach ($definition['arguments'] as $argument) {
if (substr($argument, 0, 1) === '@') {
$arguments[] = \Drupal::service(substr($argument, 1));
}
elseif (substr($argument, 0, 1) === '%' && substr($argument, -1) === '%') {
$arguments[] = \Drupal::getContainer()->getParameter(substr($argument, 1, -1));
}
else {
$arguments[] = $argument;
}
}
$ref_class = new \ReflectionClass(static::getPluginClass($plugin_id, $definition, $this->interface));
return $ref_class->newInstanceArgs($arguments);
}
}
...@@ -47,14 +47,6 @@ class FeedsPluginManager extends DefaultPluginManager { ...@@ -47,14 +47,6 @@ class FeedsPluginManager extends DefaultPluginManager {
'custom_source' => 'Drupal\feeds\Annotation\FeedsCustomSource', 'custom_source' => 'Drupal\feeds\Annotation\FeedsCustomSource',
'target' => 'Drupal\feeds\Annotation\FeedsTarget', 'target' => 'Drupal\feeds\Annotation\FeedsTarget',
]; ];
$plugin_interfaces = [
'fetcher' => 'Drupal\feeds\Plugin\Type\Fetcher\FetcherInterface',
'parser' => 'Drupal\feeds\Plugin\Type\Parser\ParserInterface',
'processor' => 'Drupal\feeds\Plugin\Type\Processor\ProcessorInterface',
'source' => 'Drupal\feeds\Plugin\Type\Source\SourceInterface',
'custom_source' => 'Drupal\feeds\Plugin\Type\CustomSource\CustomSourceInterface',
'target' => 'Drupal\feeds\Plugin\Type\Target\TargetInterface',
];
$this->pluginType = $type; $this->pluginType = $type;
$this->subdir = 'Feeds/' . ucfirst($type); $this->subdir = 'Feeds/' . ucfirst($type);
...@@ -63,7 +55,6 @@ class FeedsPluginManager extends DefaultPluginManager { ...@@ -63,7 +55,6 @@ class FeedsPluginManager extends DefaultPluginManager {
} }
$this->discovery = new AnnotatedClassDiscovery($this->subdir, $namespaces, $type_annotations[$type]); $this->discovery = new AnnotatedClassDiscovery($this->subdir, $namespaces, $type_annotations[$type]);
$this->discovery = new OverridableDerivativeDiscoveryDecorator($this->discovery); $this->discovery = new OverridableDerivativeDiscoveryDecorator($this->discovery);
$this->factory = new FeedsAnnotationFactory($this, $plugin_interfaces[$type]);
$this->moduleHandler = $module_handler; $this->moduleHandler = $module_handler;
$this->alterInfo("feeds_{$type}_plugins"); $this->alterInfo("feeds_{$type}_plugins");
$this->setCacheBackend($cache_backend, "feeds_{$type}_plugins"); $this->setCacheBackend($cache_backend, "feeds_{$type}_plugins");
......
...@@ -77,10 +77,6 @@ class EntityProcessorBaseTest extends FeedsKernelTestBase { ...@@ -77,10 +77,6 @@ class EntityProcessorBaseTest extends FeedsKernelTestBase {
'title' => 'Node', 'title' => 'Node',
'description' => 'Creates nodes from feed items.', 'description' => 'Creates nodes from feed items.',
'entity_type' => 'node', 'entity_type' => 'node',
'arguments' => [
'@entity_type.manager',
'@entity_type.bundle.info',
],
'form' => [ 'form' => [
'configuration' => 'Drupal\feeds\Feeds\Processor\Form\DefaultEntityProcessorForm', 'configuration' => 'Drupal\feeds\Feeds\Processor\Form\DefaultEntityProcessorForm',
'option' => 'Drupal\feeds\Feeds\Processor\Form\EntityProcessorOptionForm', 'option' => 'Drupal\feeds\Feeds\Processor\Form\EntityProcessorOptionForm',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment