BaseWidget

Namespace

Ceres\Widgets\Helper

Implements
Constants
Type Name Value Description

array

TOOLBAR_LAYOUT

['','bold,italic,underline,strike

h1,h2,h3

align

translation','bold,italic,underline,strike

headline

link

align,ul,ol

color,background

translation']

Properties
Type Name Description

array

$mapTypeToTemplate

A map for types to corresponding templates

string

$template

The template to be used for this widget

Twig

$twig

Application

$app

string

$pluginNamespace

Methods
public __construct($twig, $app)

BaseWidget constructor.

Parameters

Type

Name

Description

Twig

$twig

Class to render twig templates.

Application

$app

Helper class to retrieve information from the application.

public getData():array

Get basic information about the widget. Possible fields are - identifier - label - previewImageURL - type - categories - position

public getSettings():array

Return the structure of the settings for the widget

public getPreview($widgetSettings = [], $children = []):string

Get the html representation of the widget.

Parameters

Type

Name

Description

array

$widgetSettings

The settings provided by the widget.

array

$children

The child widgets of the widget.

public render($widgetSettings = [], $children = []):string

Render the template of the widget.

Parameters

Type

Name

Description

array

$widgetSettings

The settings provided by the widget.

array

$children

The child widgets of the widget.

public getTemplateData($widgetSettings, $isPreview):array

Get additional data to be passed to the template while rendering.

Parameters

Type

Name

Description

array

$widgetSettings

The settings provided by the widget.

bool

$isPreview

A flag provided to determine if the widget is currently shown in preview.

public getPreviewData($widgetSettings):array

Get additional data to be passed to the template while rendering the preview markup.

Parameters

Type

Name

Description

array

$widgetSettings

The settings provided by the widget.

public mockPaginatedResult($factory, $itemsPerPage = 10, $currentPage = 1, $pages = 5):array

Mock a paginated result

Parameters

Type

Name

Description

Closure

$factory

The widget factory which should be mocked.

int

$itemsPerPage

The number of items which should be mocked.

int

$currentPage

The current page of the result.

int

$pages

The total count of pages.