Scheduled Block Editable
General
The scheduled block element allows to manage scheduled content within an editable. Basically the scheduled block is very similar to the standard block editable. You can configure on or multiple sub editables that are repeated multiple times as block items. The difference is, that within the scheduled block each block item has a specific timestamp and in the frontend only one block item - the one with the corresponding timestamp - is displayed at a time (not all within a loop).
In editmode, additional block items can be added and their timestamp can be configured.
Configuration
Name | Type | Description |
---|---|---|
class |
string | A CSS class that is added to the surrounding container of this element in editmode |
Methods
Name | Return | Description |
---|---|---|
isEmpty() |
bool | Whether the editable is empty or not. |
getCount() |
int | Get the total amount of iterations. |
getCurrent() |
int | Get the current index while looping. |
getElements() |
array | Return a array for every loop to access the defined children. |
The Block Controls
Control | Operation |
---|---|
Select a day for the block item timestamp. | |
Select the time for the block item with the slider. | |
Add new block item. | |
List of all block items with jump to function. | |
Delete all block items or all block items of the past. |
Basic Usage
Please use the loop()
method to iterate through all block items. This makes sure the correct indices are set internally
to reference the right elements within a block.
As Twig does not provide a while
construct, there's a specialized function pimcore_iterate_block
which allows you
to iterate through all block elements.
<?php while($this->scheduledblock("block")->loop()) { ?>
<h2><?= $this->input("blockinput") ?><h2>
<?= $this->image("myimage") ?>
<?php } ?>
{% for i in pimcore_iterate_block(pimcore_scheduledblock('block')) %}
<h2>{{ pimcore_input('blockinput') }}</h2>
{{ pimcore_image('myimage') }}
{% endfor %}
The result in editmode should looks like to following:
And in the frontend of the application:
In document preview, Pimore provides a time slider to get the preview for a certain time as soon as the document has at least one scheduled block editable.
For details on how to create custom functionality using the time slider see Preview Scheduled Content.