function MachineName::transform
Same name in other branches
- 9 core/modules/migrate/src/Plugin/migrate/process/MachineName.php \Drupal\migrate\Plugin\migrate\process\MachineName::transform()
- 8.9.x core/modules/migrate/src/Plugin/migrate/process/MachineName.php \Drupal\migrate\Plugin\migrate\process\MachineName::transform()
- 11.x core/modules/migrate/src/Plugin/migrate/process/MachineName.php \Drupal\migrate\Plugin\migrate\process\MachineName::transform()
Overrides ProcessPluginBase::transform
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ process/ MachineName.php, line 116
Class
- MachineName
- Creates a machine name.
Namespace
Drupal\migrate\Plugin\migrate\processCode
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$new_value = $this->transliteration
->transliterate($value, LanguageInterface::LANGCODE_DEFAULT, '_');
$new_value = strtolower($new_value);
$new_value = preg_replace($this->replacePattern, '_', $new_value);
return preg_replace('/_+/', '_', $new_value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.