ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
Lightbox.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
30 class Lightbox extends Modal implements Component\Modal\Lightbox
31 {
32  private const SCHEME_BRIGHT = 'bright';
33  private const SCHEME_DARK = 'dark';
37  protected array $pages;
38 
39  protected string $scheme = self::SCHEME_BRIGHT;
40 
46  {
47  parent::__construct($signal_generator);
48  $pages = $this->toArray($pages);
49  $types = array(LightboxPage::class);
50  $this->checkArgListElements('pages', $pages, $types);
51  // if there is at least one image page, the lightbox is in dark mode.
52  array_walk($pages, function (LightboxPage $page) {
53  if ($page instanceof Component\Modal\LightboxImagePage) {
54  $this->scheme = self::SCHEME_DARK;
55  }
56  });
57  $this->pages = $pages;
58  }
59 
63  public function getPages(): array
64  {
65  return $this->pages;
66  }
67 
68  public function getScheme(): string
69  {
70  return $this->scheme;
71  }
72 }
__construct($pages, SignalGeneratorInterface $signal_generator)
Definition: Lightbox.php:45
SignalGeneratorInterface $signal_generator
Definition: Modal.php:42
getPages()
Get the lightbox pages of this modal.LightboxPage[]
Definition: Lightbox.php:63
__construct(Container $dic, ilPlugin $plugin)