Download the PHP package jorisnoo/statamic-safe-entities without Composer
On this page you can find all versions of the php package jorisnoo/statamic-safe-entities. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jorisnoo/statamic-safe-entities
More information about jorisnoo/statamic-safe-entities
Files in jorisnoo/statamic-safe-entities
Package statamic-safe-entities
Short Description A Statamic addon that provides a Blade directive and Bard buttons for safe HTML entity insertion (soft hyphens, non-breaking spaces, etc.).
License MIT
Informations about the package statamic-safe-entities
Statamic Safe Entities
A Statamic addon for safe HTML entity insertion in Bard, text, and textarea fields. Adds a Bard toolbar button for inserting soft hyphens, non-breaking spaces, en dashes, and other typography entities, plus Blade directives to render them safely.
Installation
Configuration
Publish the config file to customize which entities are available:
Default configuration:
Each entry maps an entity code to a label shown in the Bard toolbar dropdown.
Usage
Bard toolbar
The addon adds an "&" button to the Bard toolbar. Clicking it shows a dropdown of configured entities. Selecting one inserts the entity code at the cursor position.
Blade directives
Two Blade directives are available for rendering entities safely:
@entities($text) — for text/textarea fields
Escapes the string for safe HTML output, then restores configured entity codes so they render as actual entities.
@entitiesHtml($html) — for Bard/rich-text fields
Restores double-encoded entities (­ back to ­) in already-rendered HTML.
PHP
You can also call the methods directly:
Both methods accept an optional second argument to override which entities to restore:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- Joris Noordermeer
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Maintainer releases
See RELEASING.md for versioning, changelog entries and the release command.