Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattstauffer/craftcms-linkhelpers
https://github.com/mattstauffer/craftcms-linkhelpers
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mattstauffer/craftcms-linkhelpers
- Owner: mattstauffer
- Created: 2014-08-11T01:45:29.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-05T19:12:56.000Z (almost 9 years ago)
- Last Synced: 2023-03-12T11:17:17.045Z (almost 2 years ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 18
- Watchers: 2
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Twig LinkHelpers for [Craft CMS](http://buildwithcraft.com/)
Add a series of Twig filters and functions for CraftCMS to add link helpers for URLs and emails.
## Installation
1. Move the `linkhelpers` directory into your `craft/plugins` directory.
2. Go to Settings > Plugins from your Craft control panel and enable the `linkHelpers` plugin## Usage
This plugin adds several Twig filters and several Twig functions.### Filters
#### Auto-link emails
Searches a string of text for email addresses and turns them into links.```twig
{{ contentString | auto_link_emails }}
```
Or:
```twig
{% filter auto_link_emails %}
Content here with an email address like [email protected].
{% endfilter %}
```Outputs:
```htmlContent here with an email address like [email protected].
```#### Auto-link URLs
Searches a string of text for URLs and turns into links.```twig
{{ contentString | auto_link_urls }}
```
Or:
```twig
{% filter auto_link_emails %}
Content here with a URL like http://www.site.com/
{% endfilter %}
```Outputs:
```htmlContent here with a URL like http://www.site.com/
```### Functions
#### Make a link to an email address
```twig
{{ linkEmail('[email protected]') }}
```Outputs:
```html
[email protected]
```#### Make a link to a URL
```twig
{{ linkUrl('http://www.site.com/') }}
```Outputs:
```html
http://www.site.com/
```