ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\UI\Help\Purpose Class Reference

A purpose describes the intended use for a certain help text. More...

+ Collaboration diagram for ILIAS\UI\Help\Purpose:

Public Member Functions

 __construct (int $purpose)
 
 isTooltip ()
 

Static Public Member Functions

static Tooltip ()
 

Data Fields

const PURPOSE_TOOLTIP = 2
 

Protected Attributes

int $purpose
 

Detailed Description

A purpose describes the intended use for a certain help text.

Retrieving help texts is done via the HelpTextRetriever. One dimension to select a help text is the intended "topics" the text is about, the other is a "purpose". Think of the "New Object Button", which might have topics "button" "object" and "creation". A text with the purpose "tooltip" should be short: "Click here to create new learning objects here." while a text with a purpose "explanation" might talk in length about the ILIAS object system.

So "purposes" allow the UI framework to communicate which type of help text it is looking for.

This class here really is an enum and should become one once we drop support for PHP versions that do not support enums.

It should be extended via PR, preferably with the according functionality in the renderer of the UI framework.

It can not be extended by consumers, as this is a way for the UI framework to communicate its requirements about help texts to some help system. Hence we use a closed vocabulary and the class is final.

Definition at line 46 of file Purpose.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\UI\Help\Purpose::__construct ( int  $purpose)

Definition at line 52 of file Purpose.php.

References ILIAS\UI\Help\Purpose\$purpose.

54  {
55  if (!in_array($purpose, [self::PURPOSE_TOOLTIP])) {
56  throw new \InvalidArgumentException("Invalid purpose: $purpose");
57  }
58  $this->purpose = $purpose;
59  }

Member Function Documentation

◆ isTooltip()

ILIAS\UI\Help\Purpose::isTooltip ( )

Definition at line 61 of file Purpose.php.

61  : bool
62  {
63  return $this->purpose === self::PURPOSE_TOOLTIP;
64  }

◆ Tooltip()

static ILIAS\UI\Help\Purpose::Tooltip ( )
static

Definition at line 66 of file Purpose.php.

66  : self
67  {
68  return new self(self::PURPOSE_TOOLTIP);
69  }

Field Documentation

◆ $purpose

int ILIAS\UI\Help\Purpose::$purpose
protected

Definition at line 50 of file Purpose.php.

Referenced by ILIAS\UI\Help\Purpose\__construct().

◆ PURPOSE_TOOLTIP


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