Am trying to understand shortcode creation by copying examples in shortcode-core and shortcode-ui. Am using the files in shortcode-core as a base. Keep hitting my head against an error and need a nudge in the right direction.
Debugger is returning the error:
RuntimeException (404)
Template "partials/sc-bluebox.html.twig" is not defined.
Created two directories inside the shortcode-core directory: templates/partials
Inside /partials is a file called sc-bluebox.html.twig:
<div class="blueBox-wrapper clearfix">
<div class="blueBox">
<div class="bbox">{{ shortcode.getContent() }}</div>
</div>
</div>
The actual shortcode file is: BlueBoxShortcode.php
<?php
namespace Grav\Plugin\Shortcodes;
{
public function init()
{
$this->shortcode->getHandlers()->add('blubox', function(ShortcodeInterface $sc) {
// Add assets
$this->shortcode->addAssets('css', 'plugin://shortcode-core/css/sc-sandbox.css');
$output = $this->twig->processTemplate('partials/sc-bluebox.html.twig', [
'shortcode' => $sc,
]);
return $output;
});
}
}
For some reason (unknown to me), the twig file seems to be not found (404)? At least that's how I'm reading the error message. I've tried a variety of path changes to no avail.
FYI, the markdown text is something like this:
[blubox]This is the content that we're going to insert into the nested blue box.[/blubox]