-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMediaModule.php
More file actions
42 lines (34 loc) · 1.43 KB
/
Copy pathMediaModule.php
File metadata and controls
42 lines (34 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare(strict_types=1);
namespace NyonCode\WireModuleMedia;
use NyonCode\WireCore\Core\Modules\Module;
use NyonCode\WireCore\Core\Resources\Navigation\NavigationGroup;
use NyonCode\WireModuleMedia\Resources\MediaResource;
/** What this package contributes: the file library. */
class MediaModule extends Module
{
public function getId(): string
{
return 'media';
}
public function resources(): array
{
return [MediaResource::class];
}
public function navigation(): ?NavigationGroup
{
$group = NavigationGroup::make((string) config('wire-module-media.navigation.group', 'content'))
->icon('outline:rectangle-stack')
->sort((int) config('wire-module-media.navigation.sort', 80));
$label = config('wire-module-media.navigation.label');
// A closure, and that is not style: `navigation()` is called while
// core spreads modules into the registries, which is **before** this
// package's own provider has registered its translations. A `__()`
// evaluated there misses, and the translator caches the miss for the
// whole request — so every later lookup in this namespace answers
// with the key. Resolved at render, it is simply right.
return is_string($label) && $label !== ''
? $group->label($label)
: $group->label(fn (): string => __('wire-module-media::messages.content'));
}
}