Download the PHP package csoellinger/silverstripe-limit-characters-with-html without Composer
On this page you can find all versions of the php package csoellinger/silverstripe-limit-characters-with-html. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download csoellinger/silverstripe-limit-characters-with-html
More information about csoellinger/silverstripe-limit-characters-with-html
Files in csoellinger/silverstripe-limit-characters-with-html
Package silverstripe-limit-characters-with-html
Short Description A simple SilverStripe extension to limit DBHtmlText and DBHtmlVarChar without loosing html tags.
License MIT
Informations about the package silverstripe-limit-characters-with-html
Limit Characters With HTML Extension
This module adds an extension to DBHTMLVarchar and DBHTMLText which enables limit html text without loosing the html tags. For example if you want a teaser text written with a WYSIWYG.
- Requirements
- Installation
- License
- Configuration
private static bool html_min
private static array html_min_options
- Documentation
- public function LimitCharactersWithHtml( $limit = 20, $add = false, $exact = true ): string
- public function LimitCharactersWithHtmlToClosestWord( int $limit = 20, $add = false ): string
- public function LongerThan( int $limit, $excludeHtml = true ): bool
- Usage examples
- Maintainers
- Bugtracker
- Development and contribution
Requirements
- Silverstripe ^4 | ^5
Installation
Simply install the extension with composer
The extension will be auto added to SilverStripe\ORM\FieldType\DBHTMLVarchar and SilverStripe\ORM\FieldType\DBHTMLText by the included config file. Just run:
License
See License
Configuration
private static bool html_min
Enable/Disable html minify.
private static array html_min_options
Set HTML minify options as associative array:
collapse_whitespace
=> true|false (Default: true)disable_comments
=> true|false (Default: false)
Documentation
After installing the module you have three new methods for your db html fields.
public function LimitCharactersWithHtml( $limit = 20, $add = false, $exact = true ): string
public function LimitCharactersWithHtmlToClosestWord( int $limit = 20, $add = false ): string
public function LongerThan( int $limit, $excludeHtml = true ): bool
Usage examples
Maintainers
- Christopher Söllinger [email protected]
Bugtracker
Bugs are tracked in the issues section of this repository. Before submitting an issue please read over existing issues to ensure yours is unique.
If the issue does look like a new bug:
- Create a new issue
- Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots and screencasts can help here.
- Describe your environment as detailed as possible: Silverstripe version, Browser, PHP version, Operating System, any installed Silverstripe modules.
Please report security issues to the module maintainers directly. Please don't file security issues in the bug tracker.
Development and contribution
If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.
All versions of silverstripe-limit-characters-with-html with dependencies
pfaciana/tiny-html-minifier Version ^3.0
silverstripe/admin Version ^1
silverstripe/framework Version ^4