定制 khepin/drupal-transliterator-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

khepin/drupal-transliterator-bundle

最新稳定版本:v1.0.2

Composer 安装命令:

composer require khepin/drupal-transliterator-bundle

包简介

Symfony bundle to use drupal transliteration (eg in doctrine sluggable extension).

README 文档

README

This bundle provides a better transliterator than the one included in Doctrine Extensions. This is useful for the Sluggable behavior if you are using a non alphabetic based language. The one bundled in Doctrine extensions works fine for many languages but I found limitations with Chinese at least. Drupal provides a more advanced one.

Transliteration is the process of changing text from 北京 to Bei Jing. So that it can be url formatted afterwards.

Installation

Through the deps files add:

[KhepinDrupalTransliteratorBundle]
    git=https://github.com/khepin/KhepinDrupalTransliteratorBundle.git
    target=/bundles/Khepin/DrupalTransliteratorBundle

Run your vendor script ./bin/vendors install.

In your autoload.php register the Khepin namespace:

$loader->registerNamespaces(array(
    // ...
    'Khepin'           => __DIR__.'/../vendor/bundles',
    // ...
));

There is no real need to register the bundle as all it provides is a class with static methods to transliterate strings. Having it autoloaded is enough.

Usage

The bundle provides a Transliterator class with two methods:

  • One to just transliterate the text: Khepin\DrupalTransliteratorBundle\Transliterator::transliterate
  • One that is compatible directly with the declaration in doctrine extensions Khepin\DrupalTransliteratorBundle\Transliterator::sluggableTransliterate

The bundle also overrides the standard Doctrine Extensions Sluggable listener so that it uses this transliteration method rather than the standard one. In order to use it, change your DoctrineExtensionBundle to use the new listener:

stof_doctrine_extensions:
    class:
        sluggable: Khepin\DrupalTransliteratorBundle\Listener\SluggableListener
    mongodb:
        default: 
            sluggable: true
    # or
    orm:
        default:
            sluggable: true

统计信息

  • 总下载量: 26.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPLv2
  • 更新时间: 2012-04-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固