Created
September 20, 2014 15:15
-
-
Save plfstr/336b5f2cc96233bad991 to your computer and use it in GitHub Desktop.
Kirbytext plugin for Kirby CMS to create <figure> wrapped blockquotes, with optional <figcaption>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# ***Must be included as part of plugins/kirbytext.extend.php*** - Follow guidance here http://getkirby.com/blog/kirbytext | |
# Kirby CMS Figure Quote Plugin - Forked from https://gist.github.com/bastianallgeier/2924148#file-figure-php | |
# Blockquote markup best practice followed from http://alistapart.com/blog/post/more-thoughts-about-blockquotes-than-are-strictly-required | |
# Include in a post as follows (figquote: Example quotes need to be good ones. source: Mr Example) | |
/* Example CSS to target blockquote: | |
.blockquote {} | |
.blockquote p {} | |
.blockquote blockquote {} | |
.blockquote figcaption:before {content: "—";} | |
*/ | |
/* | |
class kirbytextExtended extends kirbytext { | |
function __construct($text=false, $markdown=true, $smartypants=true { | |
parent::__construct($text, $markdown, $smartypants); | |
*/ | |
// define custom tags | |
$this->addTags('figquote'); | |
// define custom attributes | |
$this->addAttributes('source'); | |
/* } */ | |
function figquote($params) { | |
$html = '<figure class="blockquote">'; | |
if(!empty($params['figquote'])) { | |
$html .= '<blockquote><p>' . $params['figquote'] . '</p></blockquote>'; | |
if(!empty($params['source'])) { | |
$html .= '<figcaption>' . $params['source'] . '</figcaption>'; | |
} | |
} | |
$html .= '</figure>'; | |
return $html; | |
} | |
/* } */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment