Apr 1, 2017

Locustv2

LinkableBehavior

If you are displaying ActiveRecord on its own route, you can use this extension to make it easier creating URLs. You won't write code like below anymore:

Html::a(
    $user->name, [
        '/user/view',
        'id' => $user->id,
    ],
    [
        'class' => 'text-success'
    ],
);

Instead, it would be $model->hotlink or

$model->getHotlink('view', ['class' => 'text-success']);

Whenever you have to change the route adjust behavior configuration in your ActiveRecord instead of going through your view files updating routes one by one. You can also link to other components or ActiveRecords that use the LinkableBehavior via getHotlinkTo().

Comments (0)

No comments yet.

Signup in order to comment.