Answer the question
In order to leave comments, you need to log in
How to get the module correctly?
I'm trying to solve the issue with my extension , here's the link, the essence of what I need to display the generated menu as is, I came to the conclusion that this will have to be done through Menuviews::widgets([]);
accordingly, in the directory of its extension, I created the Menuviews class, which inherited from Widget
, here is the extension scheme
assets //директрория
controllers //директория
messages/ru-RU/sirgalas/menu //директория
migrations //директория
models //директория
views //директория
MenuAsset.php //асеты
MenuModule.php //сам модуль
MenuView.php //то с чем пытаюсь работать
use sirgalas\menu\MenuView;
<?= MenuView::widget(['name'=>'HederMenuLeft']); ?>
use sirgalas\menu\models\Menu;
use yii\base\Widget;
use sirgalas\menu\MenuModule;
class MenuView extends Widget
{
public $name;
public function init(){
parent::init();
}
public function run(){
$model=Menu::findOne($this->name);
$module= MenuModule::getInstance();
return var_dump($module);
}
Answer the question
In order to leave comments, you need to log in
There were two questions 1 there is a feeling that I'm doing shit code is it so?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question