Smarty-Modifier in PDF-Template

Zwar schon ne Weile her. Das Problem ist, dass die Plugin-Verzeichnisse bei der Dokument-Erstellung nicht von Shopware gesetzt werden. Anbei die Lösung über ein eigenes Plugin:

dein-plugin-ordner/Resources/sevices.xml

<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
       ...
        <service id="dein_plugin.subscriber.document_subscriber" class="DeinPlugin\Subscriber\DocumentSubscriber">
            <tag name="shopware.event_subscriber"/>
        </service>
    </services>
  ...
</container>

dein-plugin-ordner/Subscriber/DocumentSubscriber.php

<?php

namespace DeinPlugin\Subscriber;

use Enlight\Event\SubscriberInterface;
use Doctrine\ORM\Events;
use Shopware\Models\Shop\Shop;

class DocumentSubscriber implements SubscriberInterface
{

  public static function getSubscribedEvents()
  {    return [
      'Shopware_Components_Document::initTemplateEngine::after' => 'onAfterInitTemplateEngine'
    ];
  }

  public function onAfterInitTemplateEngine(\Enlight_Event_EventArgs $args)
  {

    $document     = $args->getSubject();

    $shop        = Shopware()->Container()->get('shop');
    $inheritance = Shopware()->Container()->get('theme_inheritance');

    $document->_template->addPluginsDir(
      $inheritance->getSmartyDirectories($shop->getTemplate())
    );

  }
}