Manop Kongoon
Manop Kongoon

Reputation: 21

How to use link url in booster.widgets.TbButtonGroup of YiiBooster 4.x?

This code link not work... how to fix?

<?php
    $this->widget(
        'booster.widgets.TbButtonGroup', array(
            'context' => 'primary',
            'buttons' => array(
                array('label' => UserModule::t('Manage User'), 'url' => Yii::app()->createUrl('/user/admin'), 'icon'=>'fa fa-users','tooltip'=>'ทดสอบ', 'visible' => UserModule::isAdmin()),
                array('label' => UserModule::t('List User'), 'url' => array('/user'),'icon'=>'fa fa-users'),
                array('label' => UserModule::t('Profile'), 'url' => array('/user/profile'),'icon'=>'fa fa-user'),
                array('label' => UserModule::t('Edit'), 'url' => array('edit'),'icon'=>'fa fa-edit'),
                array('label' => UserModule::t('Change password'), 'url' => array('changepassword'),'icon'=>'fa fa-pencil'),
                array('label' => UserModule::t('Logout'), 'url' => array('/user/logout'),'icon'=>'fa fa-sign-out')
            ),
        )
    );
    ?>

This is output.. it's not show link...

<div class="btn-group"><button class="btn btn-primary" id="yw0" data-toggle="tooltip" name="yt0" type="button"><i class="fa fa-users"></i> จัดการผู้ใช้งาน</button><button class="btn btn-primary" id="yw1" name="yt1" type="button"><i class="fa fa-users"></i> รายการผู้ใช้งาน</button><button class="btn btn-primary" id="yw2" name="yt2" type="button"><i class="fa fa-user"></i> โพรไฟล์</button><button class="btn btn-primary" id="yw3" name="yt3" type="button"><i class="fa fa-edit"></i> แก้ไข</button><button class="btn btn-primary" id="yw4" name="yt4" type="button"><i class="fa fa-pencil"></i> เปลี่ยนรหัสผ่าน</button><button class="btn btn-primary" id="yw5" name="yt5" type="button"><i class="fa fa-sign-out"></i> ออกจากระบบ</button></div>

Upvotes: 0

Views: 1165

Answers (2)

vladdark
vladdark

Reputation: 11

You need to specify the type of button you need

tray this:

Yii::import('booster.widgets.TbButton');
$this->widget(
    'booster.widgets.TbButtonGroup',
            [
                'buttons' => [
                    [
                        'label' => 'Descargar',
                        'buttonType'=> TbButton::BUTTON_LINK,
                        'icon'=>'fa fa-download',  
                        'url' => Yii::app()->baseUrl,
                    ],
                    [
                        'label' => 'Editar', 
                        'buttonType'=> TbButton::BUTTON_LINK,
                        'icon'=>'fa fa-pencil', 
                        'url' => Yii::app()->baseUrl,
                    ],
                ],
            ]
        );

Upvotes: 1

Antoan Milkov
Antoan Milkov

Reputation: 2228

The url parameter should be string, not array.

So, instead of
array('label' => UserModule::t('List User'), 'url' => array('/user'),'icon'=>'fa fa-users')

Try with
array('label' => UserModule::t('List User'), 'url' => '/user', 'icon'=>'fa fa-users')

If it is not working, then most probably some of the components is not loaded or JavaScript is disabled.

I will be able to help you more if you provide URL where I can see the page with the issues.

Upvotes: 0

Related Questions