SideNavWidget

In doing some updates to a backend theme (yii2-sb-admin-theme), I decided to use SideNavWidget. However I get


Class 'Yii\apidoc\templates\bootstrap\SideNavWidget' not found

Searching


vendor/yiisoft

in my Yii application fails to find the file.

My class declaration is…


class MetisNav extends yii\apidoc\templates\bootstrap\SideNavWidget

I also tried…


class MetisNav extends yii\bootstrap\SideNavWidget

as per the Nav & NavBar widgets. Same error.

So is this a bit of documented Yii functionality gone MIA?

Looking a bit further into this…

I’ve learned what


yii2-apidoc

is, but this file looks like a complete misfit. The code looks like a Nav widget, the documentation looks like for a Nav widget, but the location,


yii\apidoc\templates

, seems wrong for it. Could this be a file misplaced?

SideNavWidget seems to be a dedicated widget for yii2-apidoc extension. I’m not sure if it could be used in other places than API documentation projects.

Anyway, did you add yii2-apidoc in the required section of your project’s composer.json and execute “composer update”? I think it’s the minimum requirement that you have to fulfill before you try to use it.

It is probably the same widget that is in use by the new Yii site:

SideNav

So, it seems to me that the simplest solution is to write your own SideNavWidget in your project.

You could copy/paste the SideNavWidget.php file to your "components" directory for example.

That’s exactly what I had in mind to try :)