chill_document_edit_button: create new twig extension

This commit is contained in:
2022-02-02 12:44:04 +01:00
parent 53e03395f2
commit 2af3de4f61
7 changed files with 105 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\DocStoreBundle\Templating;
use Chill\DocStoreBundle\Entity\StoredObject;
use Twig\Environment;
use Twig\Extension\RuntimeExtensionInterface;
class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
{
public const TEMPLATE = '@ChillDocStore/Button/wopi_edit_document.html.twig';
public function renderEditButton(Environment $environment, StoredObject $document): string
{
return $environment->render(self::TEMPLATE, [
'document' => $document
]);
}
}