Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/js/pages/section-defaults/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defineProps({
<tr v-for="collection in collections" :key="collection.handle">
<td>
<div class="flex items-center gap-2">
<Icon name="collections" class="text-gray-500 me-1" />
<Icon :name="collection.icon" class="text-gray-500 me-1" />
<Link :href="cp_url(`seo-pro/section-defaults/collections/${collection.handle}/edit`)" v-text="__(collection.title)" />
</div>
</td>
Expand Down
15 changes: 11 additions & 4 deletions src/Http/Controllers/CP/SectionDefaultsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Statamic\SeoPro\Http\Controllers\CP;

use Inertia\Inertia;
use Statamic\Facades\Collection;
use Statamic\Facades\Taxonomy;
use Statamic\Contracts\Entries\Collection;
use Statamic\Facades;
use Statamic\Http\Controllers\CP\CpController;

class SectionDefaultsController extends CpController
Expand All @@ -14,8 +14,15 @@ public function index()
$this->authorize('edit seo section defaults');

return Inertia::render('seo-pro::SectionDefaults/Index', [
'collections' => Collection::all()->sortBy('title')->values(),
'taxonomies' => Taxonomy::all()->sortBy('title')->values(),
'collections' => Facades\Collection::all()
->sortBy('title')
->map(fn (Collection $collection): array => [
'title' => $collection->title(),
'handle' => $collection->handle(),
'icon' => $collection->icon(),
])
->values(),
'taxonomies' => Facades\Taxonomy::all()->sortBy('title')->values(),
]);
}
}