function MachineName::__construct

Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/migrate/process/MachineName.php \Drupal\migrate\Plugin\migrate\process\MachineName::__construct()
  2. 8.9.x core/modules/migrate/src/Plugin/migrate/process/MachineName.php \Drupal\migrate\Plugin\migrate\process\MachineName::__construct()
  3. 10 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.

File

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

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');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.