Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MachineName.php

function 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\process

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal