Download the PHP package infoweb-internet-solutions/yii2-cms-alias without Composer
On this page you can find all versions of the php package infoweb-internet-solutions/yii2-cms-alias. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download infoweb-internet-solutions/yii2-cms-alias
More information about infoweb-internet-solutions/yii2-cms-alias
Files in infoweb-internet-solutions/yii2-cms-alias
Package yii2-cms-alias
Short Description Alias module for Yii2
License MIT
Informations about the package yii2-cms-alias
Alias module for Yii 2
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply modify your application configuration as follows:
Your backend configuration as follows:
Import the translations and use category 'infoweb/alias':
To use the module, execute yii migration
Behavior
The AliasBehavior
is used to manage the url
field for the entity that the Alias
is attached to.
The behavior has to be attached to an ActiveRecord
class that has a language identifier.
Below is an example of how it can be attached to \infoweb\pages\models\Lang
The url
field can be rendered in your ActiveForm
view
If you want to automatically generate the alias based on the content of another field add this to its configuration:
Trait
The AliasRelationTrait
is used to extend the entity for which you want to enable the usage of Alias
.
It defines custom event(s), thegetAlias
relation for the model and the findByAlias
method.
Below is an example of how it can be attached to infoweb\pages\models\Page
You should also add a getUrl
method to the entity (or modify it if it already exists) that uses the url
field of the getAlias
relation.
All versions of yii2-cms-alias with dependencies
infoweb-internet-solutions/yii2-cms Version @stable
infoweb-internet-solutions/yii2-cms-pages Version @stable