transliteration example

$this->setMockContainerService('csrf_token');
    $this->assertNotNull(\Drupal::csrfToken());
  }

  /** * Tests the transliteration() method. * * @covers ::transliteration */
  public function testTransliteration() {
    $this->setMockContainerService('transliteration');
    $this->assertNotNull(\Drupal::transliteration());
  }

  /** * Tests the formBuilder() method. * * @covers ::formBuilder */
  public function testFormBuilder() {
    $this->setMockContainerService('form_builder');
    $this->assertNotNull(\Drupal::formBuilder());
  }

  
/** * {@inheritdoc} */
  public function getMachineNameSuggestion() {
    $definition = $this->getPluginDefinition();
    $admin_label = $definition['admin_label'];

    // @todo This is basically the same as what is done in     // \Drupal\system\MachineNameController::transliterate(), so it might make     // sense to provide a common service for the two.     $transliterated = $this->transliteration()->transliterate($admin_label, LanguageInterface::LANGCODE_DEFAULT, '_');
    $transliterated = mb_strtolower($transliterated);

    $transliterated = preg_replace('@[^a-z0-9_.]+@', '', $transliterated);

    return $transliterated;
  }

  /** * {@inheritdoc} */
  public function getPreviewFallbackString() {
    
Home | Imprint | This part of the site doesn't use cookies.