Ich versuche, Shortcodes zu einem WYSIWYG hinzuzufügen. Ich verwende this library. Ich versuche, dies in eine accordion from bootstrap zu analysieren:Versuchen, einen Shortcode mit Thunderer/Shortcode zu analysieren
[panel]
[header]
Heading goes here
[/header]
[content] Content goes here [/content]
[header]
Heading goes here
[/header]
[content] Content goes here [/content]
[/panel]
Mein Code sieht so aus:
use Thunder\Shortcode\HandlerContainer\HandlerContainer;
use Thunder\Shortcode\Parser\RegularParser;
use Thunder\Shortcode\Processor\Processor;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
function processAgendaContent($content)
{
$handlers = new HandlerContainer();
$handlers->add('panel', function(ShortcodeInterface $s) {
return "<div class=\"panel panel-default\">";
});
$handlers->add('header', function(ShortcodeInterface $s) {
return '
<h4 class="panel-title">
<a href="#collapse1" target="_blank" role="button" data-toggle="collapse" aria-expanded="true" aria-controls="collapse1" class="btn-collapse">
' . $s->getContent() . '</a>
</h4>';
});
$processor = new Processor(new RegularParser(), $handlers);
echo $processor->process($content);
Mein Problem jetzt ist, dass, wenn ich versuche zu analysieren, ist es das Starttag parst aber nicht das schließende Tag, und ich stelle mir vor, dass getContent() nicht funktioniert. Irgendeine Idee was mache ich falsch? Danke
Awesome Bibliothek Mann! – raygo