addShortcode() public static method

Add a shortcode handler
public static addShortcode ( string $tag, function $function )
$tag string the shortcode tag
$function function the shortcode handling function
Esempio n. 1
0
 public function testAddShortcode()
 {
     Post::addShortcode('gallery', function (ShortcodeInterface $s) {
         return $s->getName() . '.' . $s->getParameter('id') . '.' . $s->getParameter('size');
     });
     $post = Post::find(123);
     $this->assertEquals($post->content, 'test gallery.123.medium shortcodes');
 }