I use http://www.yiiframework.com/doc-2.0/yii-behaviors-sluggablebehavior.html

I try to change the slug before saving to the database

[ 'class' => SluggableBehavior::className(), 'attribute' => 'name', // 'slugAttribute' => 'slug', // 'immutable' => true, // 'ensureUnique'=>true, 'value' => function( $event ) { return 'test'; }, ], 

As a result, a slug is generated by the automaton with the name, and the idea should be 'test'. What am I doing wrong ?

  • zakomementyl 'attribute' => 'name', Now works out the 'value' => function( $event ) { return 'тест'; }, 'value' => function( $event ) { return 'тест'; }, But now it does not translate, i.e. Wrote test, test and returned, not test :( - Guest
  • found the answer to your question here at stackoverflow.com/questions/31073610/… - Guest

0