diff --git a/src/controllers/NavigationController.php b/src/controllers/NavigationController.php index 65b6591..2558a79 100644 --- a/src/controllers/NavigationController.php +++ b/src/controllers/NavigationController.php @@ -6,7 +6,9 @@ use verbb\cpnav\models\Navigation as NavigationModel; use Craft; +use craft\base\Volume; use craft\elements\Asset; +use craft\helpers\Html; use craft\helpers\Json; use craft\web\Controller; @@ -132,9 +134,20 @@ public function actionGetHudHtml(): Response $nav->manualNav = true; } + $volumes = Craft::$app->getVolumes()->getAllVolumes(); + $sourcesOptions = []; + + /** @var Volume $volume */ + foreach ($volumes as $volume) { + $sourceOptions[] = [ + 'label' => Html::encode($volume->name), + 'value' => $volume->id, + ]; + } + $variables = [ 'nav' => $nav, - 'sources' => Craft::$app->volumes->getPublicVolumes(), + 'sources' => $sourcesOptions, 'elementType' => Asset::class, ];