72 final public function txt($id) {
73 return $this->lng->txt($id);
88 final protected function getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks) {
90 $path =
"src/UI/templates/default/$component/$name";
91 return $this->tpl_factory->getTemplate(
$path, $purge_unfilled_vars, $purge_unused_blocks);
105 if ($binder === null) {
108 $id = $this->js_binding->createId();
109 $on_load_code = $binder($id);
110 if (!is_string($on_load_code)) {
111 throw new \LogicException(
112 "Expected JavaScript binder to return string".
113 " (used component: ".get_class($component).
")");
115 $this->js_binding->addOnLoadCode($on_load_code);
130 if(!is_array($interfaces)){
131 throw new \LogicException(
132 "Expected array, found '".(
string)(null).
"' when rendering.");
135 foreach ($interfaces as $interface) {
136 if ($component instanceof $interface) {
140 $ifs = implode(
", ", $interfaces);
141 throw new \LogicException(
142 "Expected $ifs, found '".get_class($component).
"' when rendering.");
156 $class = get_class($this);
159 $re =
"%ILIAS\\\\UI\\\\Implementation\\\\Component\\\\(\\w+)\\\\(\\w+)%";
160 if (preg_match($re, $class, $matches) !== 1) {
161 throw new \LogicException(
162 "The Renderer needs to be located in ILIAS\\UI\\Implementation\\Component\\*.");
Registry for resources required by rendered output like Javascript or CSS.
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
An entity that renders components to a string output.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
txt($id)
Get a text from the language file.
getComponentInterfaceName()
Get the name of the component-interface this renderer is supposed to render.
This is how the factory for UI elements looks.
getOnLoadCode()
Get the currently bound on load code.
__construct(Factory $ui_factory, TemplateFactory $tpl_factory, \ilLanguage $lng, JavaScriptBinding $js_binding)
Component renderers must only depend on a UI-Factory and a Template Factory.
Provides methods to interface with javascript.
Create styles array
The data for the language used.
getUIFactory()
Get a UI factory.
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.null
Interface for a factory that provides templates.
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.