ILIAS
trunk Revision v12.0_alpha-1221-g4e438232683
◀ ilDoc Overview
MailTemplateContextAdapter.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Mail\TemplateEngine
;
22
23
use
ilMailTemplateContext
;
24
use
ilObjUser
;
25
35
class
MailTemplateContextAdapter
36
{
37
public
function
__construct
(
39
protected
array $contexts,
40
protected
array $context_parameter,
41
protected
readonly
TemplateEngineInterface
$template_engine,
42
protected
?
ilObjUser
$recipient =
null
43
) {
44
}
45
46
public
function
withContext
(
ilMailTemplateContext
$context): self
47
{
48
$clone = clone $this;
49
$clone->contexts[] = $context;
50
return
$clone;
51
}
52
53
public
function
__isset
(
string
$name): bool
54
{
55
foreach
($this->contexts as $context) {
56
$possible_placeholder = array_map(
57
static
function
($placeholder):
string
{
58
return
strtoupper($placeholder);
59
},
60
array_keys($context->getPlaceholders())
61
);
62
if
(\in_array($name, $possible_placeholder,
true
)) {
63
return
true
;
64
}
65
}
66
67
return
false
;
68
}
69
70
public
function
__get
(
string
$name): string
71
{
72
foreach
($this->contexts as $context) {
73
$ret = $context->resolvePlaceholder($name, $this->context_parameter, $this->recipient);
74
if
(\in_array($name, $context->getNestedPlaceholders(),
true
)) {
75
$ret = $this->template_engine->render($ret, $this);
76
}
77
if
($ret !==
''
) {
78
return
$ret;
79
}
80
}
81
82
return
''
;
83
}
84
}
ILIAS\Mail\TemplateEngine\MailTemplateContextAdapter
This class forms an interface between the existing ILIAS mail contexts and the requirements of the te...
Definition:
MailTemplateContextAdapter.php:36
ILIAS\Mail\TemplateEngine\MailTemplateContextAdapter\__isset
__isset(string $name)
Definition:
MailTemplateContextAdapter.php:53
ILIAS\Mail\TemplateEngine\MailTemplateContextAdapter\__get
__get(string $name)
Definition:
MailTemplateContextAdapter.php:70
ILIAS\Mail\TemplateEngine\MailTemplateContextAdapter\withContext
withContext(ilMailTemplateContext $context)
Definition:
MailTemplateContextAdapter.php:46
ILIAS\__construct
__construct()
Constructor setup ILIAS global object @access public.
Definition:
class.ilias.php:76
ilMailTemplateContext
Definition:
class.ilMailTemplateContext.php:25
ilObjUser
User class.
Definition:
class.ilObjUser.php:48
ILIAS\Mail\TemplateEngine\TemplateEngineInterface
Interface for template engine functionality used in Mail and related components.
Definition:
TemplateEngineInterface.php:29
ILIAS\Mail\TemplateEngine
Definition:
MailTemplateContextAdapter.php:21
components
ILIAS
Mail
src
TemplateEngine
MailTemplateContextAdapter.php
Generated on Sun Apr 5 2026 23:03:23 for ILIAS by
1.9.4 (using
Doxyfile
)