Skip to content

Instantly share code, notes, and snippets.

@float-mode
Forked from bastianallgeier/kirbytext.extended.php
Last active September 6, 2015 09:04
Show Gist options
  • Save float-mode/9f1b195bd7168ce470e4 to your computer and use it in GitHub Desktop.
Save float-mode/9f1b195bd7168ce470e4 to your computer and use it in GitHub Desktop.
A template to extend the kirbytext class

Kirbytext Extension Template

Use this template to extend the kirbytext class with your own tags. Put this into site/plugins and name it kirbytext.php or kirbytext.extended.php

<?php
class kirbytextExtended extends kirbytext {
function __construct($text, $markdown=true) {
parent::__construct($text, $markdown);
/*
// define custom tags
$this->addTags('mynewtag', 'anothertag');
// define custom attributes
$this->addAttributes('mynewattribute', 'anotherattribute');
*/
}
/*
// define a function for each new tag you specify
function mynewtag($params) {
// do something with the passed params here.
}
*/
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment