Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

preview_from_text()

Description

Generates preview text of a certain line length and count

Can be used for generating previews of text output, such as messages.

@var string $text The text to generate the preview of, can contain HTML
@var int $line_length The number of characters that the preview can have on each line
@var int $line_count The number of lines to be generated in the preview
@var bool $add_ellipsis Should ellipsis (...) be added if the original $text exceeds $line_count

Parameters

ColumnTypeDefaultDescription
$text string
$line_length int
$line_count int
$add_ellipsis bool

Return

string Returns a string of the preview text, or an empty string if the preview is unable to be generated

This article was last updated 5th September 2025 17:35 Europe/London time based on the source file dated 5th September 2025 11:45 Europe/London time.