Commit fa4016a0 authored by Tino Goratsch's avatar Tino Goratsch

buffer the output of the template events so that we can use them much more flexibly

parent 7dd8bdaf
......@@ -42,13 +42,20 @@ class Event extends AbstractFunction
* @param array $params
* @param \Smarty_Internal_Template $smarty
*
* @return mixed
* @return string
*/
public function process(array $params, \Smarty_Internal_Template $smarty)
{
if (isset($params['name'])) {
ob_start();
$this->eventDispatcher->dispatch($params['name'], new TemplateEvent($this->parseArguments($params)));
$result = ob_get_contents();
ob_end_clean();
return $result;
}
return '';
}
/**
......
......@@ -4,16 +4,12 @@
{/if}
<form action="{$REQUEST_URI}#comments" method="post" accept-charset="UTF-8" class="form-horizontal" data-ajax-form="true" data-ajax-form-loading-text="{lang t="system|loading_please_wait"}">
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true maxlength=20 readonly=$form.name_disabled label={lang t="system|name"}}
<div class="form-group">
<label for="message" class="col-sm-2 control-label required">{lang t="system|message"}</label>
<div class="col-sm-10">
{if $can_use_emoticons}
{event name="emoticons.render_emoticons_list"}
{/if}
<textarea class="form-control" name="message" id="message" cols="50" rows="5" required>{$form.message}</textarea>
</div>
</div>
{if $can_use_emoticons}
{$before_textarea={event name="emoticons.render_emoticons_list"}}
{else}
{$before_textarea=''}
{/if}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"} before_textarea=$before_textarea}
{event name="captcha.event.display_captcha"}
{include file="asset:System/Partials/form_group.submit.tpl" form_token=$form_token}
</form>
......
......@@ -3,13 +3,7 @@
{block AJAX_FORM_CONTENT}
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true maxlength=20 readonly=$form.name_disabled label={lang t="system|name"}}
{include file="asset:System/Partials/form_group.input_email.tpl" name="mail" value=$form.mail required=true readonly=$form.mail_disabled maxlength=120 label={lang t="system|email_address"}}
<div class="form-group">
<label for="message" class="col-sm-2 control-label required">{lang t="system|message"}</label>
<div class="col-sm-10">
<textarea class="form-control" name="message" id="message" cols="50" rows="5" required>{$form.message}</textarea>
</div>
</div>
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"}}
{include file="asset:System/Partials/form_group.checkbox.tpl" options=$copy}
{event name="captcha.event.display_captcha"}
{include file="asset:System/Partials/form_group.submit.tpl" form_token=$form_token}
......
{extends file="asset:System/layout.ajax-form.tpl"}
{block AJAX_FORM_CONTENT}
<div class="form-group">
<label for="message" class="col-sm-2 control-label required">{lang t="system|message"}</label>
<div class="col-sm-10">
{if $can_use_emoticons}
{event name="emoticons.render_emoticons_list"}
{/if}
<textarea class="form-control" name="message" id="message" cols="50" rows="5" required>{$form.message}</textarea>
</div>
</div>
{if $can_use_emoticons}
{$before_textarea={event name="emoticons.render_emoticons_list"}}
{else}
{$before_textarea=''}
{/if}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"} before_textarea=$before_textarea}
{if !empty($activate)}
{include file="asset:System/Partials/form_group.button_group.tpl" options=$activate required=true label={lang t="guestbook|activate_entry"}}
{/if}
......
......@@ -10,16 +10,12 @@
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true readonly=$form.name_disabled maxlength=20 label={lang t="system|name"}}
{include file="asset:System/Partials/form_group.input_email.tpl" name="mail" value=$form.mail readonly=$form.mail_disabled maxlength=120 label={lang t="system|email_address"}}
{include file="asset:System/Partials/form_group.input_url.tpl" name="website" value=$form.website readonly=$form.website_disabled maxlength=120 label={lang t="system|website"}}
<div class="form-group">
<label for="message" class="col-sm-2 control-label required">{lang t="system|message"}</label>
<div class="col-sm-10">
{if $can_use_emoticons}
{event name="emoticons.render_emoticons_list"}
{/if}
<textarea class="form-control" name="message" id="message" cols="50" rows="6" required>{$form.message}</textarea>
</div>
</div>
{if $can_use_emoticons}
{$before_textarea={event name="emoticons.render_emoticons_list"}}
{else}
{$before_textarea=''}
{/if}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"} before_textarea=$before_textarea}
{if isset($subscribe_newsletter)}
{include file="asset:System/Partials/form_group.checkbox.tpl" options=$subscribe_newsletter}
{/if}
......
......@@ -4,16 +4,12 @@
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true readonly=$form.name_disabled maxlength=20 label={lang t="system|name"}}
{include file="asset:System/Partials/form_group.input_email.tpl" name="mail" value=$form.mail readonly=$form.mail_disabled maxlength=120 label={lang t="system|email_address"}}
{include file="asset:System/Partials/form_group.input_url.tpl" name="website" value=$form.website readonly=$form.website_disabled maxlength=120 label={lang t="system|website"}}
<div class="form-group">
<label for="message" class="col-sm-2 control-label required">{lang t="system|message"}</label>
<div class="col-sm-10">
{if $can_use_emoticons}
{event name="emoticons.render_emoticons_list"}
{/if}
<textarea class="form-control" name="message" id="message" cols="50" rows="6" required>{$form.message}</textarea>
</div>
</div>
{if $can_use_emoticons}
{$before_textarea={event name="emoticons.render_emoticons_list"}}
{else}
{$before_textarea=''}
{/if}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"} before_textarea=$before_textarea}
{if isset($subscribe_newsletter)}
{include file="asset:System/Partials/form_group.checkbox.tpl" options=$subscribe_newsletter}
{/if}
......
......@@ -2,6 +2,9 @@
{block FORM_GROUP_LABEL_ID}{$name|replace:'_':'-'}{/block}
{block FORM_GROUP_FORM_FIELD}
{if !empty($before_textarea)}
{$before_textarea}
{/if}
<textarea class="form-control"
name="{$name}"
id="{$name|replace:'_':'-'}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment