ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
HasHelpTopics.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
24 
25 trait HasHelpTopics
26 {
28  protected array $help_topics = [];
29 
33  public function withHelpTopics(Topic ...$topics): static
34  {
35  $clone = clone $this;
36  $clone->help_topics = array_unique($topics, SORT_REGULAR);
37  sort($clone->help_topics);
38  return $clone;
39  }
40 
44  public function withAdditionalHelpTopics(Topic ...$topics): static
45  {
46  $clone = clone $this;
47  $clone->help_topics = array_unique(array_merge($this->help_topics, $topics), SORT_REGULAR);
48  sort($clone->help_topics);
49  return $clone;
50  }
51 
55  public function getHelpTopics(): array
56  {
57  return $this->help_topics;
58  }
59 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This is just a class that marks a string as a help topic.
Definition: Topic.php:26
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:25
withAdditionalHelpTopics(Topic ... $topics)