Goli
Goli

Reputation: 436

how to view backend crud from frontend yii2 advanced folder

I am using yii2 advanced app. and in frontend I am using tabsx widget from which I want to open backend\view\companies\index.php.

Is it possible to do so and how?

here is code frontend\views\contacts\index.php

echo TabsX::widget([
    'position' => TabsX::POS_ABOVE,
    'align' => TabsX::ALIGN_LEFT,
    'items' => [
        [
            'label' => 'gridview',
            'content' => $content_grid,//**want backend\view\companies\index.php page to open here... how to do it.. **
            'active' => true
        ],
        [
            'label' => 'Basic Search',
            'content' => $content_basic_search,
            'headerOptions' => ['style'=>'font-weight:bold'],
            'options' => ['id' => 'myveryownID'],
        ],
        [
            'label' => 'Dropdown',
            'items' => [
                 [
                     'label' => 'DropdownA',
                     'content' => 'DropdownA, Anim pariatur cliche...',
                 ],
                 [
                     'label' => 'DropdownB',
                     'content' => 'DropdownB, Anim pariatur cliche...',
                 ],
            ],
        ],
    ],
]);

how to get that?

Upvotes: 1

Views: 302

Answers (2)

MasteRus
MasteRus

Reputation: 111

I don't use this widget before, but I think, it will help:

  1. Add a BackendUrlManager in config (common/config/main.php):

    'components' => [
        'urlManagerBackend' => [
            'baseUrl' => 'http://backend.myproject.com', //Here you need to insert your backend app link
            'class'=>'yii\web\UrlManager',
            'enablePrettyUrl' => true,
            'showScriptName' => false,
        ],
    ...
    ]
    
  2. Use a link

    'linkOptions'=>['data-url'=>Yii::$app->urlManagerBackend->createAbsoluteUrl(['backend/view/companies/index'])])]
    

Upvotes: 0

Kyle
Kyle

Reputation: 745

Have you tried using linkOptions?

'linkOptions'=>['data-url'=>\yii\helpers\Url::to(['backend/view/companies/index'])]

Upvotes: 0

Related Questions