We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nav is a great Widget!
i want to improve function isItemActive(), then can support "range page" property, you can use:
Nav::widget([ 'items' => ['label' => 'Product', 'url' => ['product/index'], 'rangepage' => [['product/view']]], ])
and the improved function isItemActive():
protected function isItemActive($item) { if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) { $route = $item['url'][0]; if ($route[0] !== '/' && Yii::$app->controller) { $route = Yii::$app->controller->module->getUniqueId() . '/' . $route; } if (!isset($item['rangepage'])) { if (ltrim($route, '/') !== $this->route) { return false; } unset($item['url']['#']); if (count($item['url']) > 1) { foreach (array_splice($item['url'], 1) as $name => $value) { if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) { return false; } } } } else { if (ltrim($route, '/') == $this->route) { unset($item['url']['#']); if (count($item['url']) > 1) { $_m = true; foreach (array_splice($item['url'], 1) as $name => $value) { if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) { $_m = false; break; } } if ($_m) { return true; } } else { return true; } } foreach ($item['rangepage'] as $rpitem) { $rproute = $rpitem[0]; if ($rproute[0] !== '/' && Yii::$app->controller) { $rproute = Yii::$app->controller->module->getUniqueId() . '/' . $rproute; } if (ltrim($rproute, '/') !== $this->route) { continue; } $range_matched = true; foreach (array_splice($rpitem, 1) as $name => $value) { if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) { $range_matched = false; break; } } if ($range_matched) { return true; } } return false; } return true; } return false; }
The text was updated successfully, but these errors were encountered:
Issue moved to yiisoft/yii2-bootstrap#102
Sorry, something went wrong.
No branches or pull requests
Nav is a great Widget!
i want to improve function isItemActive(),
then can support "range page" property, you can use:
and the improved function isItemActive():
The text was updated successfully, but these errors were encountered: