<div id="btnwrap{{ key }}" class="editor__btn-wrap">
{% include '@ui/common/buttons/split.html.twig' with {
primary: {
text: actionForm.label,
htmlClass: 'btn-publish',
size: 'lg',
helper: 'primary',
htmlId: 'btn' ~ key ~ 'Immediate'
},
secondary: {
sronly: true,
text: actionForm.label,
icon: 'clock-o',
htmlClass: 'btn-schedule',
size: 'lg',
helper: 'primary',
htmlId: 'btn' ~ key ~ 'Schedule',
helpText: 'Schedule a later publish date.',
}
} %}
</div>
{% set buttons %}
<p>
{% include '@ui/common/buttons/forms/submit.html.twig' with {
text: 'Schedule',
helper: actionForm.helper|default('success'),
size: 'lg',
block: true
} %}
</p>
{% endset %}
{% include '@CmsModule/Content/includes/editor/action_modal.html.twig' with {
action: key,
icon: actionForm.icon|default(null),
heading: actionForm.title|default(actionForm.label),
lead: actionForm.header,
form: actionForm.form,
footer: actionForm.footer,
buttons: buttons
} %}
{% inline_script %}
<script>
editorActionHandler('{{ key }}', function (e) {
var $modal = $('#modal{{ key }}'),
$frm = $('#frm{{ key }}'),
$target = $(e.currentTarget);
switch ($target.attr('id')) {
case 'btn{{ key }}Schedule':
$('#{{ actionForm.form['publishAt'].vars.id }}').attr('required', true);
$modal.modal({});
break;
case 'btn{{ key }}Immediate':
$('#{{ actionForm.form['publishAt'].vars.id }}').attr('required', false);
$frm.submit();
break;
}
e.preventDefault();
});
</script>
{% endinline %}