Open
Description
Here is how I'm using tags without SluggableBehavior.
In application config:
'components' => [
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules'=> [
['pattern'=>'tag/<tag>', 'route'=>'tag/view'],
]
],
]
In view file:
<?php foreach ($model->getTagNames(true) as $tag) : ?>
<?= Html::a($tag, ['/tag/view', 'tag' => $tag]) ?>
<?php endforeach ?>
If we have a tag tag with whitespace
we will have a generated link:
/tag/tag+with+whitespace
This link will call TagController:actionView()
method and bypass tag
parameter in Yii::$app->request->queryParams
array.