Ok, I hadn’t tested it, and I was on the right track, but needed a smidge more logic:
// Add images to twig template paths to allow inclusion of SVG files
public function onTwigLoader()
{
$theme_paths = Grav::instance()['locator']->findResources('theme://images');
foreach(array_reverse($theme_paths) as $images_path) {
$this->grav['twig']->addPath($images_path, 'images');
}
}
is the final method that gets all the theme paths (including inherited ones) and only includes paths that exist. However, for this to work in your inherited theme, you must extend the base theme:
<?php
namespace Grav\Theme;
use Grav\Common\Grav;
use Grav\Common\Theme;
class QuarkChild extends Quark
{
}
If you simply extend the Theme
class, you would need to copy over the contents of the quark.php
class to this one.