protected function ConfigEntityReference::generateMachineName in Feeds 8.3
Generates a machine name from a string.
This is basically the same as what is done in \Drupal\Core\Block\BlockBase::getMachineNameSuggestion() and \Drupal\system\MachineNameController::transliterate(), but it seems that so far there is no common service for handling this.
Parameters
string $string: The string to generate a machine name for.
Return value
string The generated machine name.
See also
\Drupal\Core\Block\BlockBase::getMachineNameSuggestion()
\Drupal\system\MachineNameController::transliterate()
1 call to ConfigEntityReference::generateMachineName()
- UserRole::createRole in src/
Feeds/ Target/ UserRole.php - Creates a new role with the given label and saves it.
File
- src/
Feeds/ Target/ ConfigEntityReference.php, line 261
Class
- ConfigEntityReference
- Defines a config entity reference mapper.
Namespace
Drupal\feeds\Feeds\TargetCode
protected function generateMachineName($string) {
$transliterated = $this->transliteration
->transliterate($string, LanguageInterface::LANGCODE_DEFAULT, '_');
$transliterated = mb_strtolower($transliterated);
$transliterated = preg_replace('@[^a-z0-9_.]+@', '_', $transliterated);
return $transliterated;
}