public function FrontendEnvironmentBase::getMachineNameSuggestion in Build Hooks 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/FrontendEnvironmentBase.php \Drupal\build_hooks\Plugin\FrontendEnvironmentBase::getMachineNameSuggestion()
File
- src/
Plugin/ FrontendEnvironmentBase.php, line 156
Class
- FrontendEnvironmentBase
- Base class for Frontend environment plugins.
Namespace
Drupal\build_hooks\PluginCode
public function getMachineNameSuggestion() {
$definition = $this
->getPluginDefinition();
$admin_label = $definition['admin_label'];
$transliterated = $this
->transliteration()
->transliterate($admin_label, LanguageInterface::LANGCODE_DEFAULT, '_');
$transliterated = mb_strtolower($transliterated);
$transliterated = preg_replace('@[^a-z0-9_.]+@', '', $transliterated);
return $transliterated;
}