ILIAS  release_8 Revision v8.24
ILIAS\MetaData\Copyright\Renderer Class Reference
+ Inheritance diagram for ILIAS\MetaData\Copyright\Renderer:
+ Collaboration diagram for ILIAS\MetaData\Copyright\Renderer:

Public Member Functions

 __construct (Factory $factory)
 
 toUIComponents (CopyrightDataInterface $copyright)
 

Protected Member Functions

 buildIcon (CopyrightDataInterface $copyright)
 
 buildLink (CopyrightDataInterface $copyright)
 
 customIcon (string $src, string $alt)
 
 standardLink (string $label, string $action)
 
 textInLegacy (string $text)
 

Protected Attributes

Factory $factory
 

Detailed Description

Definition at line 28 of file Renderer.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Copyright\Renderer::__construct ( Factory  $factory)

Definition at line 32 of file Renderer.php.

34 {
35 $this->factory = $factory;
36 }

References ILIAS\MetaData\Copyright\Renderer\$factory.

Member Function Documentation

◆ buildIcon()

ILIAS\MetaData\Copyright\Renderer::buildIcon ( CopyrightDataInterface  $copyright)
protected

Definition at line 58 of file Renderer.php.

58 : ?Icon
59 {
60 if (!$copyright->imageLink()) {
61 return null;
62 }
63 return $this->customIcon(
64 (string) $copyright->imageLink(),
65 $copyright->altText()
66 );
67 }
customIcon(string $src, string $alt)
Definition: Renderer.php:80

References ILIAS\MetaData\Copyright\CopyrightDataInterface\altText(), ILIAS\MetaData\Copyright\Renderer\customIcon(), and ILIAS\MetaData\Copyright\CopyrightDataInterface\imageLink().

Referenced by ILIAS\MetaData\Copyright\Renderer\toUIComponents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLink()

ILIAS\MetaData\Copyright\Renderer::buildLink ( CopyrightDataInterface  $copyright)
protected

Definition at line 69 of file Renderer.php.

69 : ?Link
70 {
71 if (!$copyright->link()) {
72 return null;
73 }
74 return $this->standardLink(
75 $copyright->fullName() !== '' ? $copyright->fullName() : (string) $copyright->link(),
76 (string) $copyright->link()
77 );
78 }
standardLink(string $label, string $action)
Definition: Renderer.php:85

References ILIAS\MetaData\Copyright\CopyrightDataInterface\fullName(), ILIAS\MetaData\Copyright\CopyrightDataInterface\link(), and ILIAS\MetaData\Copyright\Renderer\standardLink().

Referenced by ILIAS\MetaData\Copyright\Renderer\toUIComponents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customIcon()

ILIAS\MetaData\Copyright\Renderer::customIcon ( string  $src,
string  $alt 
)
protected

Definition at line 80 of file Renderer.php.

80 : Icon
81 {
82 return $this->factory->symbol()->icon()->custom($src, $alt, Icon::MEDIUM);
83 }

References ILIAS\UI\Component\Symbol\Icon\Icon\MEDIUM.

Referenced by ILIAS\MetaData\Copyright\Renderer\buildIcon().

+ Here is the caller graph for this function:

◆ standardLink()

ILIAS\MetaData\Copyright\Renderer::standardLink ( string  $label,
string  $action 
)
protected

Definition at line 85 of file Renderer.php.

85 : Link
86 {
87 return $this->factory->link()->standard($label, $action);
88 }

Referenced by ILIAS\MetaData\Copyright\Renderer\buildLink().

+ Here is the caller graph for this function:

◆ textInLegacy()

ILIAS\MetaData\Copyright\Renderer::textInLegacy ( string  $text)
protected

Definition at line 90 of file Renderer.php.

90 : Legacy
91 {
92 return $this->factory->legacy($text);
93 }

Referenced by ILIAS\MetaData\Copyright\Renderer\toUIComponents().

+ Here is the caller graph for this function:

◆ toUIComponents()

ILIAS\MetaData\Copyright\Renderer::toUIComponents ( CopyrightDataInterface  $copyright)
Returns
Icon[]|Link[]|Legacy[]

Definition at line 41 of file Renderer.php.

41 : array
42 {
43 $res = [];
44 $has_link = false;
45 if (!is_null($image = $this->buildIcon($copyright))) {
46 $res[] = $image;
47 }
48 if (!is_null($link = $this->buildLink($copyright))) {
49 $res[] = $link;
50 $has_link = true;
51 }
52 if ($copyright->fullName() && !$has_link) {
53 $res[] = $this->textInLegacy($copyright->fullName());
54 }
55 return $res;
56 }
buildIcon(CopyrightDataInterface $copyright)
Definition: Renderer.php:58
buildLink(CopyrightDataInterface $copyright)
Definition: Renderer.php:69
$res
Definition: ltiservices.php:69

References $res, ILIAS\MetaData\Copyright\Renderer\buildIcon(), ILIAS\MetaData\Copyright\Renderer\buildLink(), ILIAS\MetaData\Copyright\CopyrightDataInterface\fullName(), and ILIAS\MetaData\Copyright\Renderer\textInLegacy().

+ Here is the call graph for this function:

Field Documentation

◆ $factory

Factory ILIAS\MetaData\Copyright\Renderer::$factory
protected

Definition at line 30 of file Renderer.php.

Referenced by ILIAS\MetaData\Copyright\Renderer\__construct().


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