本文整理匯總了PHP中common\models\Category::getParentsOnly方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::getParentsOnly方法的具體用法?PHP Category::getParentsOnly怎麽用?PHP Category::getParentsOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common\models\Category
的用法示例。
在下文中一共展示了Category::getParentsOnly方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_menu
public static function get_menu()
{
$categories = Category::getParentsOnly();
$categories = self::categoryToList($categories);
$sub_categories[] = ['label' => "Зворотний зв'язок", 'url' => Url::toRoute(['/site/contact'])];
if (Yii::$app->user->isGuest) {
$sub_categories[] = ['label' => 'Реєстрація', 'url' => Url::toRoute(['/site/signup'])];
$sub_categories[] = ['label' => 'Вхід', 'url' => Url::toRoute(['/site/login'])];
} else {
$sub_categories[] = ['label' => "Профіль", 'url' => Url::toRoute(['/user/view', 'id' => $userId = \Yii::$app->user->identity->id])];
$sub_categories[] = ['label' => 'Вихід (' . Yii::$app->user->identity->username . ')', 'url' => Url::toRoute(['/site/logout']), 'linkOptions' => ['data-method' => 'post']];
}
$categories[] = ['label' => '<i class=" glyphicon glyphicon-user"></i>', 'items' => $sub_categories];
return $categories;
}