ILIAS  release_7 Revision v7.30-3-g800a261c036
LightboxImagePage.php
Go to the documentation of this file.
1<?php
2
4
9use \ILIAS\UI\Component\Modal\LightboxImagePage as ILightboxImagePage;
10
19class LightboxImagePage implements LightboxDescriptionEnabledPage, ILightboxImagePage
20{
22
26 protected $image;
30 protected $title;
34 protected $description;
35
36
42 public function __construct(Image $image, $title, $description = '')
43 {
44 $this->checkArgInstanceOf('image', $image, Image::class);
45 $this->checkStringArg('title', $title);
46 $this->checkStringArg('description', $description);
47 $this->image = $image;
48 $this->title = $title;
49 $this->description = $description;
50 }
51
52
56 public function getTitle()
57 {
58 return $this->title;
59 }
60
61
65 public function getDescription() : string
66 {
67 return $this->description ? $this->description : $this->image->getAlt();
68 }
69
70
74 public function getComponent()
75 {
76 return $this->image;
77 }
78}
An exception for terminatinating execution or to throw for unit testing.
getTitle()
Get the title of this page, displayed as title in the lightbox modal.string
__construct(Image $image, $title, $description='')
getDescription()
Get the description of this page, displayed along with the media item.string
getComponent()
Get the component representing the media item to be displayed in the modals content section,...
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
trait ComponentHelper
Provides common functionality for component implementations.
checkArgInstanceOf($which, $value, $class)
Throw an InvalidArgumentException if $value is not an instance of $class.