You are here

public function MachineName::__construct in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/migrate/process/MachineName.php \Drupal\migrate\Plugin\migrate\process\MachineName::__construct()
  2. 9 core/modules/migrate/src/Plugin/migrate/process/MachineName.php \Drupal\migrate\Plugin\migrate\process\MachineName::__construct()

Constructs a MachineName plugin.

Parameters

array $configuration: The plugin configuration.

string $plugin_id: The plugin ID.

mixed $plugin_definition: The plugin definition.

\Drupal\Component\Transliteration\TransliterationInterface $transliteration: The transliteration service.

Overrides PluginBase::__construct

File

core/modules/migrate/src/Plugin/migrate/process/MachineName.php, line 93

Class

MachineName
Creates a machine name.

Namespace

Drupal\migrate\Plugin\migrate\process

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, TransliterationInterface $transliteration) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->transliteration = $transliteration;
  $this->replacePattern = $this->configuration['replace_pattern'] ?? '/[^a-z0-9_]+/';
  if (!is_string($this->replacePattern)) {
    throw new MigrateException('The replace pattern should be a string');
  }
}