zabachok/yii2-sluggable-behavior

Поведение для транслитерации кирилицы в латиницу.

Installs: 1 677

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

0.0.1 2016-05-27 10:27 UTC

This package is auto-updated.

Last update: 2024-04-11 15:54:07 UTC


README

Поведение для транслитерации кирилицы в латиницу.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist zabachok/yii2-sluggable-behavior "*"

or add

"zabachok/yii2-sluggable-behavior": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

Behavior for transliterate russian text to latin.

Использовать так же как и оригинальное поведение. Класс унаследован от \yii\behaviors\SluggableBehavior просто переопределен метод generateSlug

use zabachok\behaviors\SluggableBehavior;

public function behaviors()
{
	 return [
		 [
			 'class' => SluggableBehavior::className(),
			 'attribute' => 'title',
			 // 'slugAttribute' => 'slug',
		 ],
	 ];
}