pstaender / silverstripe-emoji-parser
Emoji Parser for SilverStripe
Installs: 356
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 2
Open Issues: 2
Type:silverstripe-module
Requires
- php: >=5.2.0
This package is auto-updated.
Last update: 2024-11-19 09:32:04 UTC
README
Render Emojis in your template, so that a :smile:
becomes a real 😄
Usage
Copy or clone the project to your SilverStripe instance folder or using composer:
composer require pstaender/silverstripe-emoji-parser dev-master
Wheny you're done flush SilverStripe cache with ?flush=1
.
In your templates you can now parse Emojis with:
<h1>$Title</h1> $Content.Parse(Emoji)
Of course also in combination with other parsers:
<h1>$Title</h1> $Content.Parse(BBCodeParser).Parse(Emoji)
All rendered icon-image-tags contain the class emoji
so that you can easily define a style, for instance:
img.emoji { height: 1em; margin: 0 1em 0 1em; }
JSON for clientside JavaScript usage
You can access all emojis including the url to graphics by requesting Emojis_Controller
:
http://yourserver/Emojis_Controller/
and use the responded JSON:
{ "100": "silverstripe-emoji-parser/graphics/emojis/100.png", "-1": "silverstripe-emoji-parser/graphics/emojis/-1.png", "+1": "silverstripe-emoji-parser/graphics/emojis/+1.png", … }
Optional configuration
You can optionally configure these values in your config.yml
:
Emojis: basePath: pathToGraphics cssClass: classNameForCSS
TODO
Implement alternate unicode characters.
Original Project and License
The images are taken from Emoji-Cheat-Sheet.com and are under different Licenses.
This module is under The MIT License (MIT).