79 return $this->lng->txt(
$id);
88 $this->lng->toJS(
$key);
98 return $this->lng->getLangKey();
125 return $this->tpl_factory->getTemplate(
$path, $purge_unfilled_vars, $purge_unused_blocks);
137 return "src/UI/templates/default/$component/$name";
166 if ($binder ===
null) {
169 $id = $this->js_binding->createId();
170 $on_load_code = $binder(
$id);
171 if (!is_string($on_load_code)) {
172 throw new \LogicException(
173 "Expected JavaScript binder to return string" .
174 " (used component: " . get_class($component) .
")"
177 $this->js_binding->addOnLoadCode($on_load_code);
190 if (count($triggered_signals) == 0) {
195 foreach ($triggered_signals as $triggered_signal) {
196 $signal = $triggered_signal->getSignal();
197 $event = $triggered_signal->getEvent();
198 $options = json_encode($signal->getOptions());
200 "$('#{$id}').on('{$event}', function(event) {
201 $(this).trigger('{$signal}',
203 'id' : '{$signal}', 'event' : '{$event}',
204 'triggerer' : $(this),
205 'options' : JSON.parse('{$options}')
226 if (!is_array($interfaces)) {
227 throw new \LogicException(
228 "Expected array, found '" . (
string) (
null) .
"' when rendering."
232 foreach ($interfaces as $interface) {
233 if ($component instanceof $interface) {
237 $ifs = implode(
", ", $interfaces);
238 throw new \LogicException(
239 "Expected $ifs, found '" . get_class($component) .
"' when rendering."
255 $class = get_class($this);
258 $re =
"%ILIAS\\\\UI\\\\Implementation\\\\Component\\\\(\\w+)\\\\(\\w+)%";
259 if (preg_match($re, $class, $matches) !== 1) {
260 throw new \LogicException(
261 "The Renderer needs to be located in ILIAS\\UI\\Implementation\\Component\\*."
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
Base class for all component renderers.
__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.
txt($id)
Get a text from the language file.
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
getTemplatePath($name)
Get the path to the template of this component.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.
checkComponent(Component $component)
Check if a given component fits this renderer and throw \LogicError if that is not the case.
getLangKey()
Get current language key.
addTriggererOnLoadCode(Triggerer $triggerer)
Add onload-code for triggerer.
toJS($key)
Add language var to client side (il.Language)
getUIFactory()
Get a UI factory.
getComponentInterfaceName()
Get the name of the component-interface this renderer is supposed to render.
bindOnloadCode(JavaScriptBindable $component)
Bind the JavaScript onload-code.
if(!array_key_exists('StateId', $_REQUEST)) $id
A component is the most general form of an entity in the UI.
Interface to be extended by components that have the possibility to bind to Javascript.
withAdditionalOnLoadCode(\Closure $binder)
Add some onload-code to the component instead of replacing the existing one.
getOnLoadCode()
Get the currently bound on load code.
getTriggeredSignals()
Get all triggered signals of this component.
This is how the factory for UI elements looks.
An entity that renders components to a string output.
Provides methods to interface with javascript.
Registry for resources required by rendered output like Javascript or CSS.
Interface for a factory that provides templates.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.