Skip to content
Snippets Groups Projects
Commit 028a0a14 authored by Ivan Doroshenko's avatar Ivan Doroshenko Committed by Lucas Hedding
Browse files

Resolve #3232488 "Deprecate transliteration plugin"

parent 4f7fe5a3
No related branches found
No related tags found
1 merge request!18Resolve #3232488 "Deprecate transliteration plugin"
...@@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Provides a plugin to use a callable from a service class. * Provides a plugin to use a callable from a service class.
* *
* Example: * Examples:
* *
* @code * @code
* process: * process:
...@@ -20,6 +20,27 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -20,6 +20,27 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* source: filename * source: filename
* @endcode * @endcode
* *
* @code
* source:
* # plugin ...
* constants:
* langcode: en
* slash: /
* process:
* transliterated_value:
* plugin: service
* service: transliteration
* method: transliterate
* unpack_source: true
* source:
* - original_value
* - constants/langcode
* - constants/slash
* @endcode
*
* Since Drupal 9.2.0, it is possible to supply multiple arguments using
* unpack_source property. See: https://www.drupal.org/node/3205079
*
* All options for the callback plugin can be used, except for 'callable', * All options for the callback plugin can be used, except for 'callable',
* which will be ignored. * which will be ignored.
* *
......
...@@ -34,6 +34,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -34,6 +34,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @MigrateProcessPlugin( * @MigrateProcessPlugin(
* id = "transliteration" * id = "transliteration"
* ) * )
*
* @deprecated in migrate_plus:8.x-5.3 and is removed from migrate_plus:6.0.0.
* Use 'service' process plugin instead. See https://www.drupal.org/node/3255994
*
* @see https://www.drupal.org/node/3255994
*/ */
class Transliteration extends ProcessPluginBase implements ContainerFactoryPluginInterface { class Transliteration extends ProcessPluginBase implements ContainerFactoryPluginInterface {
...@@ -57,6 +62,7 @@ class Transliteration extends ProcessPluginBase implements ContainerFactoryPlugi ...@@ -57,6 +62,7 @@ class Transliteration extends ProcessPluginBase implements ContainerFactoryPlugi
* The transliteration service. * The transliteration service.
*/ */
public function __construct(array $configuration, $plugin_id, $plugin_definition, TransliterationInterface $transliteration) { public function __construct(array $configuration, $plugin_id, $plugin_definition, TransliterationInterface $transliteration) {
@trigger_error(__CLASS__ . ' is deprecated in migrate_plus:8.x-5.3 and is removed from migrate_plus:6.0.0. Use Drupal\migrate_plus\Plugin\migrate\process\Service process plugin instead. See https://www.drupal.org/node/3255994', E_USER_DEPRECATED);
parent::__construct($configuration, $plugin_id, $plugin_definition); parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->transliteration = $transliteration; $this->transliteration = $transliteration;
} }
......
...@@ -48,4 +48,14 @@ class TransliterationTest extends MigrateProcessTestCase { ...@@ -48,4 +48,14 @@ class TransliterationTest extends MigrateProcessTestCase {
$this->assertEquals($expected_result, $value); $this->assertEquals($expected_result, $value);
} }
/**
* Tests deprecation notice of Transliteration process plugin.
*
* @group legacy
*/
public function testDeprecationMessage() {
$this->expectDeprecation("Drupal\migrate_plus\Plugin\migrate\process\Transliteration is deprecated in migrate_plus:8.x-5.3 and is removed from migrate_plus:6.0.0. Use Drupal\migrate_plus\Plugin\migrate\process\Service process plugin instead. See https://www.drupal.org/node/3255994");
new Transliteration([], 'transliteration', [], $this->transliteration);
}
} }
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