Skip to content

Commit

Permalink
fix volume sources
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Jungnickel committed Dec 11, 2017
1 parent 3fc38ed commit 0abd72b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/controllers/NavigationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
];

Expand Down

0 comments on commit 0abd72b

Please sign in to comment.