You are here

public function EntityBlockBlock::getMachineNameSuggestion in Entityblock 8

Overrides BlockPluginTrait::getMachineNameSuggestion

File

src/Plugin/Block/EntityBlockBlock.php, line 137
Contains \Drupal\entityblock\Plugin\Block\EntityBlockBlock.

Class

EntityBlockBlock
Provides an entityblock block.

Namespace

Drupal\entityblock\Plugin\Block

Code

public function getMachineNameSuggestion() {
  $transliterated = $this
    ->transliteration()
    ->transliterate($this
    ->label(), LanguageInterface::LANGCODE_DEFAULT, '_');
  $transliterated = Unicode::strtolower($transliterated);
  $transliterated = preg_replace('@[^a-z0-9_.]+@', '', $transliterated);
  return $transliterated;
}