當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Drupal::transliteration方法代碼示例

本文整理匯總了PHP中Drupal::transliteration方法的典型用法代碼示例。如果您正苦於以下問題:PHP Drupal::transliteration方法的具體用法?PHP Drupal::transliteration怎麽用?PHP Drupal::transliteration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal的用法示例。


在下文中一共展示了Drupal::transliteration方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTransliteration

 /**
  * Get the transliteration object.
  *
  * @return \Drupal\Core\Transliteration\PhpTransliteration
  *   The transliteration object.
  */
 protected function getTransliteration()
 {
     if (!isset($this->transliteration)) {
         $this->transliteration = \Drupal::transliteration();
     }
     return $this->transliteration;
 }
開發者ID:Nikola-xiii,項目名稱:d8intranet,代碼行數:13,代碼來源:MachineName.php

示例2: transliteration

 /**
  * Wraps the transliteration service.
  *
  * @return \Drupal\Component\Transliteration\TransliterationInterface
  */
 protected function transliteration()
 {
     if (!$this->transliteration) {
         $this->transliteration = \Drupal::transliteration();
     }
     return $this->transliteration;
 }
開發者ID:neetumorwani,項目名稱:blogging,代碼行數:12,代碼來源:BlockBase.php

示例3: getMachineNameSuggestion

 /**
  * {@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.
     $transliteration_service = \Drupal::transliteration();
     $transliterated = $transliteration_service->transliterate($admin_label, LanguageInterface::LANGCODE_DEFAULT, '_');
     $replace_pattern = '[^a-z0-9_.]+';
     $transliterated = Unicode::strtolower($transliterated);
     if (isset($replace_pattern)) {
         $transliterated = preg_replace('@' . $replace_pattern . '@', '', $transliterated);
     }
     return $transliterated;
 }
開發者ID:shumer,項目名稱:blog,代碼行數:19,代碼來源:BlockBase.php

示例4: testTransliteration

 /**
  * Tests the transliteration() method.
  *
  * @covers ::transliteration
  */
 public function testTransliteration()
 {
     $this->setMockContainerService('transliteration');
     $this->assertNotNull(\Drupal::transliteration());
 }
開發者ID:dmyerson,項目名稱:d8ecs,代碼行數:10,代碼來源:DrupalTest.php


注:本文中的Drupal::transliteration方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。