ILIAS  release_8 Revision v8.24
ILIAS\MainMenu\Provider\CustomMainBarProvider Class Reference

Class CustomMainBarProvider. More...

+ Inheritance diagram for ILIAS\MainMenu\Provider\CustomMainBarProvider:
+ Collaboration diagram for ILIAS\MainMenu\Provider\CustomMainBarProvider:

Public Member Functions

 __construct (Container $dic, \ilMainMenuAccess $access=null)
 @inheritDoc More...
 
 getSingleCustomItem (ilMMCustomItemStorage $storage, bool $register=false)
 
 provideTypeInformation ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getAllIdentifications ()
 @inheritDoc More...
 
 provideTypeInformation ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getFullyQualifiedClassName ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider
 getStaticTopItems ()
 
 getStaticSubItems ()
 
 provideTypeInformation ()
 
 getAllIdentifications ()
 

Protected Attributes

Container $dic
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
Container $dic
 
IdentificationProviderInterface $if
 
MainMenuItemFactory $mainmenu
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
Container $dic
 

Private Member Functions

 translateType (string $type)
 
 translateByline (string $type)
 

Private Attributes

ilMainMenuAccess $mm_access
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MainMenu\Provider\CustomMainBarProvider::__construct ( Container  $dic,
\ilMainMenuAccess  $access = null 
)

@inheritDoc

Definition at line 68 of file CustomMainBarProvider.php.

69 {
71 $this->mm_access = $access ?? new ilObjMainMenuAccess();
72 }
Class ilObjMainMenuAccess.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\MainMenu\Provider\CustomMainBarProvider\$dic, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getProviderNameForPresentation()

ILIAS\MainMenu\Provider\CustomMainBarProvider::getProviderNameForPresentation ( )

@inheritDoc

Reimplemented from ILIAS\GlobalScreen\Provider\AbstractProvider.

Definition at line 266 of file CustomMainBarProvider.php.

266 : string
267 {
268 return "Custom";
269 }

◆ getSingleCustomItem()

ILIAS\MainMenu\Provider\CustomMainBarProvider::getSingleCustomItem ( ilMMCustomItemStorage  $storage,
bool  $register = false 
)
Parameters
ilMMCustomItemStorage$storage
bool$register
Returns
isItem

Definition at line 111 of file CustomMainBarProvider.php.

111 : isItem
112 {
113 $identification = $this->globalScreen()->identification()->core($this)->identifier($storage->getIdentifier());
114
115 $item = $this->globalScreen()->mainBar()->custom($storage->getType(), $identification);
116
117 $item = $item->withVisibilityCallable(
118 $this->mm_access->isCurrentUserAllowedToSeeCustomItem(
119 $storage,
120 function () use ($item) {
121 return $item->isVisible();
122 }
123 )
124 );
125
126 if ($item instanceof hasTitle && !empty($storage->getDefaultTitle())) {
127 $item = $item->withTitle($storage->getDefaultTitle());
128 }
129 if ($item instanceof hasAction) {
130 $item = $item->withAction("#");
131 }
132 if ($item instanceof isChild) {
133 $mm_item = ilMMItemStorage::find($identification->serialize());
134 $parent_identification = '';
135 if ($mm_item instanceof ilMMItemStorage) {
136 $parent_identification = $mm_item->getParentIdentification();
137 }
138
139 if ($parent_identification) {
140 $item = $item->withParent(
141 $this->globalScreen()
142 ->identification()
143 ->fromSerializedIdentification($parent_identification)
144 );
145 }
146 }
147
148 if ($register) {
150 }
151
152 return $item;
153 }
static return function(ContainerConfigurator $containerConfigurator)
Definition: basic_rector.php:9
Class ilMMItemStorage.
static register(isItem $item)

References function, ilMMCustomItemStorage\getDefaultTitle(), ilMMCustomItemStorage\getIdentifier(), ilMMCustomItemStorage\getType(), ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen(), and ilMMItemStorage\register().

+ Here is the call graph for this function:

◆ provideTypeInformation()

ILIAS\MainMenu\Provider\CustomMainBarProvider::provideTypeInformation ( )

@inheritDoc

Reimplemented from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider.

Definition at line 158 of file CustomMainBarProvider.php.

158 : TypeInformationCollection
159 {
160 $c = new TypeInformationCollection();
161 // TopParentItem
162 $c->add(
163 new TypeInformation(
164 TopParentItem::class,
165 $this->translateType(TopParentItem::class),
166 new TopParentItemRenderer()
167 )
168 );
169 // TopLinkItem
170 $c->add(
171 new TypeInformation(
172 TopLinkItem::class,
173 $this->translateType(TopLinkItem::class),
176 )
177 );
178 // Link
179 $c->add(
180 new TypeInformation(
181 Link::class,
182 $this->translateType(Link::class),
185 )
186 );
187
188 // LinkList
189 $link_list = new TypeInformation(
190 LinkList::class,
191 $this->translateType(LinkList::class),
192 new LinkListItemRenderer()
193 );
194 $link_list->setCreationPrevented(true);
195 $c->add($link_list);
196
197 // Separator
198 $c->add(
199 new TypeInformation(
200 Separator::class,
201 $this->translateType(Separator::class),
202 new SeparatorItemRenderer(),
204 $this->translateByline(Separator::class)
205 )
206 );
207
208 // RepositoryLink
209 $c->add(
210 new TypeInformation(
211 RepositoryLink::class,
212 $this->translateType(RepositoryLink::class),
215 )
216 );
217
218 // Lost
219 $lost = new TypeInformation(
220 Lost::class,
221 $this->translateType(Lost::class),
222 new LostItemRenderer()
223 );
224 $lost->setCreationPrevented(true);
225 $c->add($lost);
226
227 // Complex
228 $complex = new TypeInformation(
229 Complex::class,
230 $this->translateType(Complex::class),
231 new ComplexItemRenderer()
232 );
233 $complex->setCreationPrevented(true);
234 $c->add($complex);
235
236 return $c;
237 }
Class ilMMLinkItemRenderer.
Class ilMMRepositoryLinkItemRenderer.
Class ilMMTopLinkItemRenderer.
Class ilMMTypeHandlerSeparator.
$c
Definition: cli.php:38

References $c, ILIAS\MainMenu\Provider\CustomMainBarProvider\translateByline(), and ILIAS\MainMenu\Provider\CustomMainBarProvider\translateType().

+ Here is the call graph for this function:

◆ translateByline()

ILIAS\MainMenu\Provider\CustomMainBarProvider::translateByline ( string  $type)
private
Parameters
string$type
Returns
string

Definition at line 255 of file CustomMainBarProvider.php.

255 : string
256 {
257 $last_part = substr(strrchr($type, "\\"), 1);
258 $last_part = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
259
260 return $this->dic->language()->txt("type_" . strtolower($last_part) . "_info");
261 }
$type

References $type.

Referenced by ILIAS\MainMenu\Provider\CustomMainBarProvider\provideTypeInformation().

+ Here is the caller graph for this function:

◆ translateType()

ILIAS\MainMenu\Provider\CustomMainBarProvider::translateType ( string  $type)
private
Parameters
string$type
Returns
string

Definition at line 243 of file CustomMainBarProvider.php.

243 : string
244 {
245 $last_part = substr(strrchr($type, "\\"), 1);
246 $last_part = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $last_part));
247
248 return $this->dic->language()->txt("type_" . strtolower($last_part));
249 }

References $type.

Referenced by ILIAS\MainMenu\Provider\CustomMainBarProvider\provideTypeInformation().

+ Here is the caller graph for this function:

Field Documentation

◆ $dic

Container ILIAS\MainMenu\Provider\CustomMainBarProvider::$dic
protected

◆ $mm_access

ilMainMenuAccess ILIAS\MainMenu\Provider\CustomMainBarProvider::$mm_access
private

Definition at line 62 of file CustomMainBarProvider.php.


The documentation for this class was generated from the following file: