PreviewRendererInterface
Interface PreviewRendererInterface
Contract for classes capable of rendering previews of a given record from a table. Responsible for rendering preview header, preview content and wrapping of those two values.
Responsibilities are segmented into three methods, one for each responsibility, which is done in order to allow overriding classes to change those parts individually without having to replace other parts. Rather than relying on implementations to be friendly and divide code into smaller pieces and give them (at least) protected visibility, the key methods are instead required on the interface directly.
Callers are then responsible for calling each method and combining/wrapping the output appropriately.
Table of Contents
Methods
- renderPageModulePreviewContent() : string
- Dedicated method for rendering preview body HTML for the page module only. Receives the the GridColumnItem that contains the record for which a preview should be rendered and returned.
- renderPageModulePreviewFooter() : string
- Render a footer for the record to display in page module below the body of the item's preview.
- renderPageModulePreviewHeader() : string
- Dedicated method for rendering preview header HTML for the page module only. Receives the the GridColumnItem that contains the record for which a preview header should be rendered and returned.
- wrapPageModulePreview() : string
- Dedicated method for wrapping a preview header and body HTML. Receives $item, an instance of GridColumnItem holding among other things the record, which can be used to determine appropriate wrapping.
Methods
renderPageModulePreviewContent()
Dedicated method for rendering preview body HTML for the page module only. Receives the the GridColumnItem that contains the record for which a preview should be rendered and returned.
public
renderPageModulePreviewContent(GridColumnItem $item) : string
Parameters
- $item : GridColumnItem
Return values
stringrenderPageModulePreviewFooter()
Render a footer for the record to display in page module below the body of the item's preview.
public
renderPageModulePreviewFooter(GridColumnItem $item) : string
Parameters
- $item : GridColumnItem
Return values
stringrenderPageModulePreviewHeader()
Dedicated method for rendering preview header HTML for the page module only. Receives the the GridColumnItem that contains the record for which a preview header should be rendered and returned.
public
renderPageModulePreviewHeader(GridColumnItem $item) : string
Parameters
- $item : GridColumnItem
Return values
stringwrapPageModulePreview()
Dedicated method for wrapping a preview header and body HTML. Receives $item, an instance of GridColumnItem holding among other things the record, which can be used to determine appropriate wrapping.
public
wrapPageModulePreview(string $previewHeader, string $previewContent, GridColumnItem $item) : string
Parameters
- $previewHeader : string
- $previewContent : string
- $item : GridColumnItem