Skip to content

Instantly share code, notes, and snippets.

@fatpixelstudio
Created September 11, 2014 13:56
Show Gist options
  • Save fatpixelstudio/c1d4901776d5febe6ddf to your computer and use it in GitHub Desktop.
Save fatpixelstudio/c1d4901776d5febe6ddf to your computer and use it in GitHub Desktop.
Add a widont tag to your kirbytext for Kirby v2
<?php
/**
* Widont
* ----
* Use widont function from kirby toolkit helpers (based on str::widont)
*
* What it does:
* If text contains more than 3 spaces, replace last space by a &nbsp:
*
* Usage:
* (widont: this is a really long but awesome title)
*/
kirbytext::$tags['widont'] = array(
'html' => function($tag) {
$text = $tag->attr('widont');
return widont($text);
}
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment