当前位置: 首页>>代码示例>>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;未经允许,请勿转载。