ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Map.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use Closure;
26use ILIAS\GlobalScreen\Scope\Metabar\Factory\isItem;
30
35class Map extends AbstractMap
36{
37 private readonly MetaBarItemFactory $factory;
38
39 public function __construct(?MetaBarItemFactory $factory = null)
40 {
42 // $this->factory = $factory;
43 }
44
45 #[\Override]
46 protected function getTitleSorter(): Closure
47 {
48 return static function (isItem $item_one, isItem $item_two): int {
49 if (!$item_one instanceof hasTitle || !$item_two instanceof hasTitle) {
50 return 0;
51 }
52
53 return strnatcmp($item_one->getTitle(), $item_two->getTitle());
54 };
55 }
56
57 #[\Override]
58 protected function getPositionSorter(): Closure
59 {
60 return static fn(isItem $item_one, isItem $item_two): int => $item_one->getPosition() - $item_two->getPosition();
61 }
62
63 protected function getLostItem(IdentificationInterface $identification): isGlobalScreenItem
64 {
65 return $this->factory->topParentItem($identification)
66 ->withVisibilityCallable(
67 fn(): bool => false
68 )->withTitle('Lost');
69 }
70}
factory()
__construct(?MetaBarItemFactory $factory=null)
Definition: Map.php:39
getLostItem(IdentificationInterface $identification)
Definition: Map.php:63
readonly MetaBarItemFactory $factory
Definition: Map.php:37
Class MetaBarItemFactory This factory provides you all available types for MainMenu GlobalScreen Item...
getPosition()
Return the default position for installation, this will be overridden by the configuration later.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc