Skip to content

Instantly share code, notes, and snippets.

@jongacnik
Last active March 29, 2019 01:37
Show Gist options
  • Save jongacnik/09628837f77fa801fac6fc3403f2b247 to your computer and use it in GitHub Desktop.
Save jongacnik/09628837f77fa801fac6fc3403f2b247 to your computer and use it in GitHub Desktop.
Kirby Plaintags

Kirby Plaintags

Helper to allow kirbytags with no options, like:

(plaintag)

Usually you would have to always at least have a default option, like:

(plaintag: hello)

Define what should be treated as plaintags in config.php

c::set('plaintags', ['plaintag']);

You'll still need to implement the tags themselves like you normally would!

<?php
kirbytext::$pre[] = function($kirbytext, $value) {
foreach (c::get('plaintags', []) as $tag) {
$value = str_replace('(' . $tag . ')', '(' . $tag . ': true)', $value);
}
return $value;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment