Get, create, delete and update links between shop builder contents and layout containers.
Plenty\Modules\ShopBuilder\Contracts
public getContentLinks(int $pluginSetId):array
Get all linked contents for a plugin set
int | $pluginSetId |
public getContentLink(int $contentLinkId):ContentLink
Get a single connection between a content and a layout container
int | $contentLinkId |
public createContentLink($data):ContentLink
Link a content to a layout container
$data |
public updateContentLink(int $contentLinkId, array $data):ContentLink
Update a link between a content and a layout container
int | $contentLinkId | |
array | $data |
public deleteContentLink(int $contentLinkId):void
Unlink a content from a layout container. The content itself will remain
int | $contentLinkId |
public getContentLinksForContainer(string $containerName, int $pluginSetId = null, string $lang = null, string $contentType = null, bool $filterResults = true):void
Get all content links for a specific layout container.
string | $containerName | The name of the layout container to get content links for. |
int | $pluginSetId | An id of a plugin set to get content links for. Active plugin set will be used by default. |
string | $lang | The language to get content links for. Current language will be get from session if not defined. |
string | $contentType | Type of the content to get |
bool | $filterResults |
Contract for content presets
Plenty\Modules\ShopBuilder\Contracts
public getWidgets():void
Get the widget configurations of the presets to be assigned to the created content.
Get, create, delete und update shop builder contents.
Plenty\Modules\ShopBuilder\Contracts
public getContents():array
Get all contents to be edited in the shop builder.
public searchContents(int $itemsPerPage = 20, int $page = 1, array $params = []):PaginatedResult
Search for contents
int | $itemsPerPage | Maximum number of items to be returned on each page |
int | $page | Current page |
array | $params | Search parameters |
public getContent(int $contentId, int $pluginSetId, string $frontendLanguage = null, string $versionId = ""):Content
Get a single content.
int | $contentId | Id of the content to get information for |
int | $pluginSetId | Plugin set id to be used for rendering widgets. |
string | $frontendLanguage | The language to be used for rendering the widgets. |
string | $versionId | The version of the content |
public listContentVersions(int $contentId, int $itemsPerPage = 20, string $versionIdMarker = ""):void
Get a list of Versions of the specified content.
int | $contentId | |
int | $itemsPerPage | |
string | $versionIdMarker |
public restoreContentVersion(int $contentId, string $versionId, int $pluginSetId, null $frontendLanguage = null):void
Restore a specific content version
int | $contentId | |
string | $versionId | |
int | $pluginSetId | |
null | $frontendLanguage |
public createContent(int $pluginSetId, $data, string $frontendLanguage = null):Content
Create new content. New content will not be linked to any layout container.
int | $pluginSetId | The plugin set to be used to render the content. The raw content data are not depending on a plugin set. |
$data | The raw content data. | |
string | $frontendLanguage | The language to be used for rendering the widgets. |
public updateContent(int $pluginSetId, int $contentId, $data, string $frontendLanguage = null):Content
Update content.
int | $pluginSetId | The plugin set to be used to render the content. The raw content data are not depending on a plugin set. |
int | $contentId | The id of the content to be updated. |
$data | The raw data of the content. | |
string | $frontendLanguage | The language to be used for rendering the widgets. |
public deleteContent(int $pluginSetId, int $contentId):void
Delete content. Any connections to layout containers will be removed too.
int | $pluginSetId | The plugin set to be used to render the content. The raw content data are not depending on a plugin set. |
int | $contentId | The id of the content to be deleted. |
public duplicateContent(int $contentId, int $targetPluginSetId, string $language, string $containerName, string $contentName):Content
Duplicate a content and its link
int | $contentId | |
int | $targetPluginSetId | |
string | $language | |
string | $containerName | |
string | $contentName |
public rebuildContents(string $containerName = null, int $pluginSetId = null):int
Rebuild all contents linked to the current plugin set.
string | $containerName | Name of the layout container to rebuild contents for. |
int | $pluginSetId | Id of the plugin set to rebuild contents for. |
Register shop builder widgets.
Plenty\Modules\ShopBuilder\Contracts
public registerWidget(string $widgetClass):void
Register a widget to be available in the shop builder.
string | $widgetClass |
public overrideWidget(string $widgetIdentifier, string $overrideWidget):void
Override a widget class to extend data or settings of the widget.
string | $widgetIdentifier | The identifier of the original widget to override |
string | $overrideWidget | The class of the new class to get information of the widget from. |
Contract for widgets with dynamic settings
Plenty\Modules\ShopBuilder\Contracts
public getData():array
Get basic information about the widget. Possible fields are
public getSettings():array
Return the structure of the settings for the widget
public getPreview(array $widgetSettings = [], array $children = []):string
Get the html representation of the widget
array | $widgetSettings | |
array | $children |
public render(array $widgetSettings = [], array $children = []):string
Render the widget
array | $widgetSettings | |
array | $children |
Contract for classes handling global settings for the ShopBuilder.
Plenty\Modules\ShopBuilder\Contracts
public readSettings():void
Read values of global settings.
public writeSettings($values):void
Store values of global settings.
$values |
Contract for content widgets
Plenty\Modules\ShopBuilder\Contracts
public getPreview(array $widgetSettings = [], array $children = []):string
Get the html representation of the widget
array | $widgetSettings | |
array | $children |
public render(array $widgetSettings = [], array $children = []):string
Render the widget
array | $widgetSettings | |
array | $children |
Helper to map global configurations to plugin configs.
Plenty\Modules\ShopBuilder\Helper
Get information about the current request made from the shop builder preview.
Plenty\Modules\ShopBuilder\Helper
public isShopBuilder():bool
Determine if the current request is made from the shop builder preview or while rendering a widget via REST.
public getPreviewContentType():string
Get the type of the previewed shop builder content.
public getPreviewUri():void
Get uri of the current preview. This might be used when rendering widgets via REST to know the context where the widget will be placed into after rendering.
public getMainContentType():string
Get the content type of the currently displayed main content.
public setMainContentType(string $mainContentType):void
Set the type of the currently displayed item content This will be used to determine the corresponding header/footer contents which are linked to a specific type.
string | $mainContentType | Possible values:
|
public getMainContainerName():string
Get the container name where the main content will be loaded into.
public setMainContainerName(string $mainContainerName):void
Set the container name where the main content will be loaded into.
string | $mainContainerName | Name of the layout container. |
public setMainCategory($mainCategory):void
Set the id of the currently displayed category.
$mainCategory | Id of the currently displayed category. |
Content created by the shop builder. May be linked to layout containers.
Plenty\Modules\ShopBuilder\Models
Type | Name | Description |
---|---|---|
int | id | The ID of the content |
string | dataProviderName | The name of the data provider |
createdAt | The date when the content was created | |
updatedAt | The date when the content was last updated | |
string | type | The type of the content |
widgets | The configured widgets of the content. This attribute is deprecated. Use $dropzones instead. | |
array | dropzones | Dropzones of the content |
ContentLink | link |
public toArray()
Returns this model as an array.
Links a content from the shop builder to a layout container of the frontend plugin.
Plenty\Modules\ShopBuilder\Models
Type | Name | Description |
---|---|---|
int | id | The ID of the content link |
int | contentId | The ID of the content |
string | containerName | The name of the container |
int | pluginSetId | The Id of the plugin set |
string | language | The language where the content is linked to. |
bool | active | Indicates if the link is active and the content should be visible for the frontend. |
string | relatedContentType | The content type the content is linked to |
string | relatedContainerName | The container name the content is linked to |
bool | inherit | Indicates if this content should be inherited to child contents. |
bool | invalid | Indicate if the content is invalid and should be regenerated on next request. |
createdAt | The date when the content was created | |
updatedAt | The date when the content was last updated | |
Content | content |
public toArray()
Returns this model as an array.
A content page provided by a frontend plugin.
Plenty\Modules\ShopBuilder\Models
Type | Name | Description |
---|---|---|
string | identifier | The identifier of the content page |
string | caption | Translation key to read the caption from |
array | dropzones | Available dropzones of this page to put contents into. |
public toArray()
Returns this model as an array.
Layout container of a content page where to display link contents generated by the shop builder.
Plenty\Modules\ShopBuilder\Models
Type | Name | Description |
---|---|---|
string | container | The container where dropped contents should be linked to. |
string | type | The type of contents which can be linked to this dropzone. |
public toArray()
Returns this model as an array.
Content widget provided by a frontend plugin
Plenty\Modules\ShopBuilder\Models
Type | Name | Description |
---|---|---|
string | identifier | The identifier of the content widget |
string | widgetClass | The class of the content widget |
string | label | The label of the content widget |
string | tooltip | The tooltip of the content widget |
string | previewImageURL | The preview image the content widget |
string | type | The type of the widget |
int | maxPerPage | Maximum occurrences per content of the widget |
array | categories | List of categories |
array | allowedNestingTypes | Allowed types to be nested inside this widget |
settings | The settings of the content widget |
public toArray()
Returns this model as an array.
The rendered preview of a content widget
Plenty\Modules\ShopBuilder\Models
Type | Name | Description |
---|---|---|
string | identifier | |
string | content |
public toArray()
Returns this model as an array.
Base class for data field providers.
Plenty\Modules\ShopBuilder\Providers
public register():void
public addField(string $identifier, string $label, string $expression):void
Register a new data field.
string | $identifier | |
string | $label | The label of the field |
string | $expression | The twig expression to be inserted by this field |
public addChildProvider(string $label, string $childProviderClass, array $params = []):void
Register a nested provider containing a list of child data fields.
string | $label | The label of the group |
string | $childProviderClass | The class name of the nested data fields provider. |
array | $params | Additional parameters to be passed to provider constructor method. |
public addSearchKeywords(string $identifier, array $keywords = []):void
Assign keywords to a field to be respected during search.
string | $identifier | The identifier of the field to assign keywords to. |
array | $keywords | A list of keywords. Each keyword may contain a translation key. A single keyword could be a comma separated list of words. |