ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
Modal.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Badge;
22 
24 use ilBadge;
25 use ilObject;
26 use ilUtil;
27 use Closure;
30 use ilWACSignedPath;
31 
32 class Modal
33 {
35  private readonly Closure $sign_file;
36 
37  public function __construct(
38  private readonly Container $container,
39  $sign_file = [ilWACSignedPath::class, 'signFile']
40  ) {
41  $this->sign_file = Closure::fromCallable($sign_file);
42  }
43 
47  public function components(ModalContent $content): array
48  {
49  $modal_content = [];
50 
51  $modal_content[] = $this->container->ui()->factory()->image()->responsive(
52  ($this->sign_file)($content->badge()->getImagePath()),
53  $content->badge()->getImage()
54  );
55  $modal_content[] = $this->container->ui()->factory()->divider()->horizontal();
56  $modal_content[] = $this->item($content);
57 
58  return $modal_content;
59  }
60 
61  private function item(ModalContent $content): Component
62  {
63  return $this->container
64  ->ui()
65  ->factory()
66  ->item()
67  ->standard($content->badge()->getTitle())
68  ->withDescription($content->badge()->getDescription())
69  ->withProperties($content->properties());
70  }
71 }
readonly Closure $sign_file
Definition: Modal.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$container
Definition: wac.php:14
__construct(private readonly Container $container, $sign_file=[ilWACSignedPath::class, 'signFile'])
Definition: Modal.php:37
components(ModalContent $content)
Definition: Modal.php:47
item(ModalContent $content)
Definition: Modal.php:61