ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
SubitemPropertiesReader.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25use ILIAS\Data\Factory as DataFactory;
26use ilLanguage;
27use ilObject;
32use Generator;
33
35{
36 protected ilLanguage $lng;
37 protected DataFactory $data_factory;
38
39 public static function type(): string
40 {
41 return 'webr';
42 }
43
44 public function init(Container $dic): void
45 {
46 $this->lng = $dic->language();
47 $this->data_factory = new DataFactory();
48 }
49
50 public function getSubitemProperties(
51 PropertiesFactory $factory,
52 int $parent_ref_id,
53 ID ...$subitem_ids
54 ): Generator {
55 $obj_id = ilObject::_lookupObjId($parent_ref_id);
56 $repo = new ilWebLinkDatabaseRepository($obj_id);
57 foreach ($subitem_ids as $subitem_id) {
58 try {
59 $item = $repo->getItemByLinkId((int) $subitem_id->id());
61 continue;
62 }
63 yield $factory->get(
64 $subitem_id,
65 $item->getTitle(),
66 $this->data_factory->uri($item->getResolvedLink(false)),
67 true,
68 $this->lng->txt('webr')
69 );
70 }
71 }
72}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
language()
Get interface to the i18n service.
Definition: Container.php:95
Builds data types.
Definition: Factory.php:36
getSubitemProperties(PropertiesFactory $factory, int $parent_ref_id, ID ... $subitem_ids)
Order of the output should respect the order of the subitem_ids.
language handling
Class ilObject Basic functions for all objects.
get(ID $id, string $title, ?URI $link_to_subitem, bool $open_link_in_new_viewport, string $presentable_subitem_type)
$dic
Definition: ltiresult.php:33