ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
TopParentItemDrilldownRenderer.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 use Exception;
30 
36 {
37  public function getComponentWithContent(isItem $item) : Component
38  {
39  $entries = [];
40  foreach ($item->getChildren() as $child) {
41  $entries[] = $this->buildEntry($child);
42  }
43 
44  $dd = $this->ui_factory->menu()->drilldown($item->getTitle(), $entries);
45 
46  return $this->ui_factory->mainControls()->slate()->drilldown(
47  $item->getTitle(),
48  $this->getStandardSymbol($item),
49  $dd
50  );
51  }
52 
53  protected function buildEntry(AbstractChildItem $item) : Component
54  {
55  $title = $item->getTitle();
56  $symbol = $this->getStandardSymbol($item);
57  $type = get_class($item);
58 
59  switch ($type) {
60  case Link::class:
61  $act = $this->getDataFactory()->uri(
62  $this->getBaseURL()
63  . '/'
64  . $item->getAction()
65  );
66  $entry = $this->ui_factory->link()->bulky($symbol, $title, $act);
67  break;
68 
69  case LinkList::class:
70  $links = [];
71  foreach ($item->getLinks() as $child) {
72  $links[] = $this->buildEntry($child);
73  }
74  $entry = $this->ui_factory->menu()->sub($title, $links);
75  break;
76 
77  default:
78  throw new Exception("Invalid type: " . $type, 1);
79  }
80 
81  return $entry;
82  }
83 
84  protected function getDataFactory() : Factory
85  {
86  return new Factory();
87  }
88 
89  private function getBaseURL() : string
90  {
91  return ILIAS_HTTP_PATH;
92  }
93 }
$type
Builds data types.
Definition: Factory.php:19
getComponentWithContent(isItem $item)
This is called in cases when the Full Item with it&#39;s content is needed, e.g.