2amigos / yiiwheels

Widget extension library for the YiiStrap extension
http://yiiwheels.2amigos.us
Other
133 stars 77 forks source link

TbNav highlits with modules #96

Closed vanya25070 closed 10 years ago

vanya25070 commented 10 years ago

this is working with higliting of current active nav item? current code not working if
$item['url'] is not set

so i solved it this way: in TbNav.php

protected function isItemActive($item, $route) {

if(isset($item['url'])){
        $itemRoute = trim($item['url'][0], '/');

        // Prepend the current module to the item route if it is not present
        if (Yii::app()->controller->module !== null && substr_count($itemRoute, '/') === 1) {
            $moduleId = Yii::app()->controller->module->id;
            $itemRoute = implode('/', array($moduleId, $itemRoute));

        }
        if ( is_array($item['url']) && !strcasecmp($itemRoute, $route)) {
            unset($item['url']['#']);
            if (count($item['url']) > 1) {
                foreach (array_splice($item['url'], 1) as $name => $value) {
                    if (!isset($_GET[$name]) || $_GET[$name] != $value) {
                        return false;
                    }
                }
            }
            return true;
        }
    }

    return false;
}
vanya25070 commented 10 years ago

sorry this is yiistrap bug