Plugin: Slideshow - API

The slideshow can not only be filled with previously created static elements, but also with dynamic content using processors. In order for the slideshow to display dynamic content, this must be activated under Configuration > CMS > Slideshow > Dynamic Content.


In the configuration you can then specify a processor class name which will be used by all slideshows which do not have their own processor. If the option to override the default values in the Slideshow boxes is checked, you can specify a processor for each slideshow. Here processors can be integrated into the system either directly by class name as in the configuration or by ObjectType.

Per class name


The referenced class must implement the interface wcf/system/slideshow/processor/ISlideshowProcessor.

Per ObjectType


DefinitionName: de.warly.plugin.slideshow.processor
Interface of the class: wcf/system/slideshow/processor/ISlideshowProcessor

The ObjectType is then displayed in the list for Dynamic Content with the name wcf.acp.slideshow.processor.[objectType].

ISlideshowProcessor

wcf/system/slideshow/processor/ISlideshowProcessor is the interface that all processors that want to provide dynamic content or modify the slideshow must support. There is the abstract class wcf/system/slideshow/processor/AbstractSlideshowProcessor, which overwrites all methods of the interface, so only the methods where something happens have to be implemented

function requiresIdentifier() Boolean


Returns a boolean that determines if an identifier must be set for each slideshow when using this processor. This identifier is then passed to the processor which can then play back customized content for each slideshow.

In AbstractSlideshowProcessor protected $requiresIdentifier = false is returned, which can be overwritten in subclasses.

function supportsStaticItems() Boolean


Returns a boolean that determines whether static elements can be added when using this processor or the processor only creates its own elements. Static elements are passed in processItems($items) and processItemSequence($items, $itemSequence).

In AbstractSlideshowProcessor protected $supportsStaticItems = true is returned, which can be overwritten in subclasses.

function getConditionsTemplate() String


Returns a string that is displayed in the form of the slideshow if this processor is selected. Additional fields but also e.g. information about the processor can be displayed here.

function setConditionsData(array $conditionsData) Void


This method is called when a slideshow is processed with this processor. The array contains the data that was returned in getConditionsData() during the last save.

function readConditions() Void


This method is called after the form has been submitted. Analogous to wcf/form/IForm::readFormParameters() the fields of the processor should be read here.

function validateConditions() Void


This method is called analogous to wcf/form/IForm::validate() after the fields have been read and should throw exceptions if an input is invalid.

function getConditionsData() Array


This method is called to store the data necessary for the processor. The returned array is given in setConditionsData(array $conditionsData) when it is edited again.

function setup(ViewableSlideshow $slideshow) Void


This method is called when rendering the slideshow and passes the ViewableSlideshow to be displayed. At this point you can change all properties of the slideshow.

function processItems(array $items) Array


This method is called with the static elements (if any) as an array of ViewableSlideshowItem elements with their itemID as key and must return an array of ViewableSlideshowItem elements. The returned array can be changed completely, there is no obligation to use the default elements.


The returned array can either also use the itemID as key or return a zero-based array. In the latter case the SlideshowBoxController will modify the array and set the itemID as key. This may make it easier to create the array.


To create your own items you should use the method ViewableSlideshowItem::create($image). It creates a temporary item with a UUID as itemID. On the created item all properties can be set arbitrarily.

function processItemSequence(array $items, array $itemSequence) Array


This method is used to determine the order in which the elements are displayed. As parameters the finished ViewableSlideshowItem array (from processItems(array $items)) and the previously created sequence of elements is passed. If no static elements are passed, the $itemSequence will only contain the keys of the elements in the order as they appear in $items.


Return value is an array with the itemIDs of the elements. The returned itemIDs must be present in $items. All non-existent itemIDs will be filtered out.