26 if ($component->getAsyncRenderUrl()) {
45 parent::registerResources($registry);
46 $registry->
register(
'./src/UI/templates/js/Modal/modal.js');
56 $show = $modal->getShowSignal();
57 $close = $modal->getCloseSignal();
61 $replace = $modal->getReplaceSignal();
65 'ajaxRenderUrl' => $modal->getAsyncRenderUrl(),
66 'keyboard' => $modal->getCloseWithKeyboard()
84 return $modal->withAdditionalOnLoadCode(
function (
$id) use ($show, $close,
$options, $replace) {
88 "$(document).on('{$show}', function(event, signalData) { il.UI.modal.showModal('{$id}', {$options}, signalData); return false; });" .
89 "$(document).on('{$close}', function() { il.UI.modal.closeModal('{$id}'); return false; });";
91 $code .=
"$(document).on('{$replace}', function(event, signalData) { il.UI.modal.replaceFromSignal('{$id}', signalData);});";
105 return "<span id='{$id}'></span>";
120 $tpl->setVariable(
'FORM_ACTION', $modal->getFormAction());
121 $tpl->setVariable(
'TITLE', $modal->getTitle());
122 $tpl->setVariable(
'MESSAGE', $modal->getMessage());
123 if (count($modal->getAffectedItems())) {
124 $tpl->setCurrentBlock(
'with_items');
125 foreach ($modal->getAffectedItems() as $item) {
126 $tpl->setCurrentBlock(
'item');
127 $icon = ($item->getIcon()) ? $default_renderer->render($item->getIcon()) :
'';
128 $desc = ($item->getDescription()) ?
'<br>' . $item->getDescription() :
'';
129 $tpl->setVariable(
'ITEM_ICON', $icon);
130 $tpl->setVariable(
'ITEM_ID', $item->getId());
131 $tpl->setVariable(
'ITEM_TITLE', $item->getTitle());
132 $tpl->setVariable(
'ITEM_DESCRIPTION', $desc);
133 $tpl->parseCurrentBlock();
136 $tpl->setVariable(
'ACTION_BUTTON_LABEL', $this->
txt($modal->getActionButtonLabel()));
137 $tpl->setVariable(
'CANCEL_BUTTON_LABEL', $this->
txt($modal->getCancelButtonLabel()));
154 $tpl->setVariable(
'TITLE', $modal->getTitle());
155 foreach ($modal->getContent() as $content) {
156 $tpl->setCurrentBlock(
'with_content');
157 $tpl->setVariable(
'CONTENT', $default_renderer->render($content));
158 $tpl->parseCurrentBlock();
160 foreach ($modal->getActionButtons() as $button) {
161 $tpl->setCurrentBlock(
'with_buttons');
162 $tpl->setVariable(
'BUTTON', $default_renderer->render($button));
163 $tpl->parseCurrentBlock();
165 $tpl->setVariable(
'CANCEL_BUTTON_LABEL', $this->
txt($modal->getCancelButtonLabel()));
182 $id_carousel =
"{$id}_carousel";
183 $pages = $modal->getPages();
184 $tpl->setVariable(
'TITLE', $pages[0]->getTitle());
185 $tpl->setVariable(
'ID_CAROUSEL', $id_carousel);
186 if (count($pages) > 1) {
187 $tpl->setCurrentBlock(
'has_indicators');
188 foreach ($pages as
$index => $page) {
189 $tpl->setCurrentBlock(
'indicators');
191 $tpl->setVariable(
'CLASS_ACTIVE', (
$index == 0) ?
'active' :
'');
192 $tpl->setVariable(
'ID_CAROUSEL2', $id_carousel);
193 $tpl->parseCurrentBlock();
196 foreach ($pages as
$i => $page) {
198 $tpl->setCurrentBlock(
'pages');
199 $tpl->touchBlock(
'page_type_text');
200 $tpl->parseCurrentBlock();
202 $tpl->setCurrentBlock(
'pages');
203 $tpl->setVariable(
'CLASS_ACTIVE', (
$i == 0) ?
' active' :
'');
204 $tpl->setVariable(
'TITLE2', htmlentities($page->getTitle(), ENT_QUOTES,
'UTF-8'));
205 $tpl->setVariable(
'CONTENT', $default_renderer->render($page->getComponent()));
207 $tpl->setVariable(
'DESCRIPTION', $page->getDescription());
209 $tpl->parseCurrentBlock();
211 if (count($pages) > 1) {
212 $tpl->setCurrentBlock(
'controls');
213 $tpl->setVariable(
'ID_CAROUSEL3', $id_carousel);
214 $tpl->parseCurrentBlock();
216 $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)
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.null
renderInterruptive(Component\Modal\Interruptive $modal, RendererInterface $default_renderer)
register($name)
Add a dependency.
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer.
Interface LightboxDescriptionEnabledPage.
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.
registerSignals(Component\Modal\Modal $modal)
getComponentInterfaceName()
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.