ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
SourceSelector.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
28 {
31 
32  public function __construct(
33  RepositoryInterface $repository,
34  CreatorInterface $creator
35  ) {
36  $this->repository = $repository;
37  $this->creator = $creator;
38  }
39 
40  public function fromObject(int $obj_id, int $sub_id, string $type): DerivatorInterface
41  {
42  if ($sub_id === 0) {
43  $sub_id = $obj_id;
44  }
45 
46  return $this->getDerivator(
47  $this->repository->getMD($obj_id, $sub_id, $type)
48  );
49  }
50 
54  public function fromBasicProperties(
55  string $title,
56  string $description = '',
57  string $language = ''
59  return $this->getDerivator(
60  $this->creator->createSet($title, $description, $language)
61  );
62  }
63 
64  protected function getDerivator(SetInterface $from_set): DerivatorInterface
65  {
66  return new Derivator(
67  $from_set,
68  $this->repository
69  );
70  }
71 }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
fromObject(int $obj_id, int $sub_id, string $type)
Choose an ILIAS object as the source.
fromBasicProperties(string $title, string $description='', string $language='')
__construct(RepositoryInterface $repository, CreatorInterface $creator)