RecordFieldPreviewProcessor
Use this to render certain fields (label + values) as kind of shortcut or helper methods when implementing your own Preview Renderer.
If you need your custom rendering, build your own renderer for your own PreviewRenderer class that you can then inject.
The result is always HTML, and it's always HSCed -> ready to be rendered.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Methods
- __construct() : mixed
- linkToEditForm() : string
- Will create a link on the input string and possibly a big button after the string which links to editing in the RTE. Used for content element content displayed so the user can click the content / "Edit in Rich Text Editor" button
- prepareField() : string|null
- Prepare the value of a field if it exists and it is not empty.
- prepareFieldWithLabel() : string|null
- Prepare the value of a field but prepend the label before.
- prepareFiles() : string|null
- Render thumbnails for a file collection or files.
- preparePlainHtml() : string|null
- preparePreviewableHtml() : string|null
- prepareText() : string|null
- Processing of larger amounts of text (usually from RTE/bodytext fields) with word wrapping, etc.
Methods
__construct()
public
__construct(TcaSchemaFactory $schemaFactory, UriBuilder $uriBuilder, IconFactory $iconFactory, SanitizerBuilderFactory $sanitizerBuilderFactory) : mixed
Parameters
- $schemaFactory : TcaSchemaFactory
- $uriBuilder : UriBuilder
- $iconFactory : IconFactory
- $sanitizerBuilderFactory : SanitizerBuilderFactory
linkToEditForm()
Will create a link on the input string and possibly a big button after the string which links to editing in the RTE. Used for content element content displayed so the user can click the content / "Edit in Rich Text Editor" button
public
linkToEditForm(string $linkText, RecordInterface $record, ServerRequestInterface $request) : string
Parameters
- $linkText : string
-
String to link. Must be prepared for HTML output.
- $record : RecordInterface
- $request : ServerRequestInterface
Return values
string —If the whole thing was editable and $linkText is not empty $linkText is returned with the link around. Otherwise just $linkText.
prepareField()
Prepare the value of a field if it exists and it is not empty.
public
prepareField(RecordInterface $record, string $fieldName) : string|null
Parameters
- $record : RecordInterface
- $fieldName : string
Return values
string|nullprepareFieldWithLabel()
Prepare the value of a field but prepend the label before.
public
prepareFieldWithLabel(RecordInterface $record, string $fieldName) : string|null
Parameters
- $record : RecordInterface
- $fieldName : string
Return values
string|nullprepareFiles()
Render thumbnails for a file collection or files.
public
prepareFiles(iterable<string|int, mixed>|FileReference $fileReferences) : string|null
Parameters
- $fileReferences : iterable<string|int, mixed>|FileReference
Return values
string|nullpreparePlainHtml()
public
preparePlainHtml(RecordInterface $record, string $fieldName[, int $maxLines = 100 ]) : string|null
Parameters
- $record : RecordInterface
- $fieldName : string
- $maxLines : int = 100
Return values
string|nullpreparePreviewableHtml()
public
preparePreviewableHtml(RecordInterface $record, string $fieldName) : string|null
Parameters
- $record : RecordInterface
- $fieldName : string
Return values
string|nullprepareText()
Processing of larger amounts of text (usually from RTE/bodytext fields) with word wrapping, etc.
public
prepareText(RecordInterface $record, string $fieldName[, int $maxLength = 1500 ]) : string|null
Parameters
- $record : RecordInterface
- $fieldName : string
- $maxLength : int = 1500