ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
LightboxImagePage.php
Go to the documentation of this file.
1 <?php
2 
4 
9 use \ILIAS\UI\Component\Modal\LightboxImagePage as ILightboxImagePage;
10 
19 class LightboxImagePage implements LightboxDescriptionEnabledPage, ILightboxImagePage
20 {
21  use ComponentHelper;
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 }
checkArgInstanceOf($which, $value, $class)
Throw an InvalidArgumentException if $value is not an instance of $class.
trait ComponentHelper
Provides common functionality for component implementations.
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
getTitle()
Get the title of this page, displayed as title in the lightbox modal.string
getDescription()
Get the description of this page, displayed along with the media item.string
__construct(Image $image, $title, $description='')
getComponent()
Get the component representing the media item to be displayed in the modals content section...