25 if ($component->getAsyncRenderUrl()) {
44 parent::registerResources($registry);
45 $registry->
register(
'./src/UI/templates/js/Modal/modal.js');
55 $show = $modal->getShowSignal();
56 $close = $modal->getCloseSignal();
58 'ajaxRenderUrl' => $modal->getAsyncRenderUrl(),
59 'keyboard' => $modal->getCloseWithKeyboard(),
77 return $modal->withAdditionalOnLoadCode(
function (
$id) use ($show, $close,
$options) {
79 "$(document).on('{$show}', function() { il.UI.modal.showModal('{$id}', {$options}); return false; });" .
80 "$(document).on('{$close}', function() { il.UI.modal.closeModal('{$id}'); return false; });";
92 return "<span id='{$id}'></span>";
107 $tpl->setVariable(
'FORM_ACTION', $modal->getFormAction());
108 $tpl->setVariable(
'TITLE', $modal->getTitle());
109 $tpl->setVariable(
'MESSAGE', $modal->getMessage());
110 if (count($modal->getAffectedItems())) {
111 $tpl->setCurrentBlock(
'with_items');
112 foreach ($modal->getAffectedItems() as $item) {
113 $tpl->setCurrentBlock(
'item');
114 $icon = ($item->getIcon()) ? $default_renderer->render($item->getIcon()) :
'';
115 $desc = ($item->getDescription()) ?
'<br>' . $item->getDescription() :
'';
116 $tpl->setVariable(
'ITEM_ICON', $icon);
117 $tpl->setVariable(
'ITEM_ID', $item->getId());
118 $tpl->setVariable(
'ITEM_TITLE', $item->getTitle());
119 $tpl->setVariable(
'ITEM_DESCRIPTION', $desc);
120 $tpl->parseCurrentBlock();
123 $tpl->setVariable(
'ACTION_BUTTON_LABEL', $this->
txt($modal->getActionButtonLabel()));
124 $tpl->setVariable(
'CANCEL_BUTTON_LABEL', $this->
txt($modal->getCancelButtonLabel()));
141 $tpl->setVariable(
'TITLE', $modal->getTitle());
142 foreach ($modal->getContent() as $content) {
143 $tpl->setCurrentBlock(
'with_content');
144 $tpl->setVariable(
'CONTENT', $default_renderer->render($content));
145 $tpl->parseCurrentBlock();
147 foreach ($modal->getActionButtons() as $button) {
148 $tpl->setCurrentBlock(
'with_buttons');
149 $tpl->setVariable(
'BUTTON', $default_renderer->render($button));
150 $tpl->parseCurrentBlock();
152 $tpl->setVariable(
'CANCEL_BUTTON_LABEL', $this->
txt($modal->getCancelButtonLabel()));
169 $id_carousel =
"{$id}_carousel";
170 $pages = $modal->getPages();
171 $tpl->setVariable(
'TITLE', $pages[0]->getTitle());
172 $tpl->setVariable(
'ID_CAROUSEL', $id_carousel);
173 if (count($pages) > 1) {
174 $tpl->setCurrentBlock(
'has_indicators');
175 foreach ($pages as
$index => $page) {
176 $tpl->setCurrentBlock(
'indicators');
178 $tpl->setVariable(
'CLASS_ACTIVE', (
$index == 0) ?
'active' :
'');
179 $tpl->setVariable(
'ID_CAROUSEL2', $id_carousel);
180 $tpl->parseCurrentBlock();
183 foreach ($pages as
$i => $page) {
184 $tpl->setCurrentBlock(
'pages');
185 $tpl->setVariable(
'CLASS_ACTIVE', (
$i == 0) ?
' active' :
'');
186 $tpl->setVariable(
'TITLE2', htmlentities($page->getTitle(), ENT_QUOTES,
'UTF-8'));
187 $tpl->setVariable(
'CONTENT', $default_renderer->render($page->getComponent()));
188 $tpl->setVariable(
'DESCRIPTION', $page->getDescription());
189 $tpl->parseCurrentBlock();
191 if (count($pages) > 1) {
192 $tpl->setCurrentBlock(
'controls');
193 $tpl->setVariable(
'ID_CAROUSEL3', $id_carousel);
194 $tpl->parseCurrentBlock();
196 $tpl->setVariable(
'ID_CAROUSEL4', $id_carousel);
Registry for resources required by rendered output like Javascript or CSS.
renderRoundTrip(Component\Modal\RoundTrip $modal, RendererInterface $default_renderer)
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
if(!array_key_exists('StateId', $_REQUEST)) $id
txt($id)
Get a text from the language file.
renderLightbox(Component\Modal\Lightbox $modal, RendererInterface $default_renderer)
registerSignals(Component\Modal\Modal $modal)
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.null
renderInterruptive(Component\Modal\Interruptive $modal, RendererInterface $default_renderer)
Create styles array
The data for the language used.
register($name)
Add a dependency.
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer.
renderAsync(Component\Modal\Modal $modal)
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.
Base class for all component renderers.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
getComponentInterfaceName()
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.