3 namespace Drupal\{{ machine_name }}\Plugin\migrate\process;
5 use Drupal\Component\Transliteration\TransliterationInterface;
6 use Drupal\Core\Language\LanguageInterface;
7 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
8 use Drupal\migrate\MigrateExecutableInterface;
9 use Drupal\migrate\ProcessPluginBase;
10 use Drupal\migrate\Row;
11 use Symfony\Component\DependencyInjection\ContainerInterface;
14 * Provides {{ plugin_id|article }} plugin.
21 * plugin: {{ plugin_id }}
25 * @MigrateProcessPlugin(
26 * id = "{{ plugin_id }}"
30 * ContainerFactoryPluginInterface is optional here. If you have no need for
31 * external services just remove it and all other stuff except transform()
34 class {{ class }} extends ProcessPluginBase implements ContainerFactoryPluginInterface {
37 * The transliteration service.
39 * @var \Drupal\Component\Transliteration\TransliterationInterface
41 protected $transliteration;
44 * Constructs {{ class|article }} plugin.
46 * @param array $configuration
47 * The plugin configuration.
48 * @param string $plugin_id
50 * @param mixed $plugin_definition
51 * The plugin definition.
52 * @param \Drupal\Component\Transliteration\TransliterationInterface $transliteration
53 * The transliteration service.
55 public function __construct(array $configuration, $plugin_id, $plugin_definition, TransliterationInterface $transliteration) {
56 parent::__construct($configuration, $plugin_id, $plugin_definition);
57 $this->transliteration = $transliteration;
63 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
68 $container->get('transliteration')
75 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
76 return $this->transliteration->transliterate($value, LanguageInterface::LANGCODE_DEFAULT);