Open OskarStark opened 8 years ago
See the usage section, point 3:
https://github.com/indigophp/sonata-admin-print-bundle#usage
Haven't found a better solution so far.
i did this:
->add('_action', 'actions', array(
'actions' => array(
'show' => array(),
'edit' => array(),
'delete' => array(),
'print' => array(
'template' => 'SonataAdminPrintBundle::list__action_print.html.twig',
),
)
))
or what do you mean?
Yeah, I meant this one.
I don't know.
Here is an admin which works for me:
https://gist.github.com/sagikazarmark/3eba1c51e66d232b051b
If it doesn't help, I will try to find out what happens tommorrow.
hmm no, i got this error:
[Symfony\Component\Translation\Exception\InvalidResourceException]
Invalid resource provided: "/Volumes/development/workspaces/tima-sonata/vendor/indigophp/sonata-admin-print-bundle/Resources/translations/SonataAdminPrin
tBundle.de.xliff"; Errors: [ERROR 1871] Element '{urn:jms:translation}reference-file': This element is not expected. Expected is ( {urn:oasis:names:tc:xl
iff:document:1.2}source ). (in /Volumes/development/workspaces/tima-sonata/ - line 14, column 0)
Oh shit, that's JMS translation bundle. You have to install that for now. But I already planned to kill that stuff.
check :)
this works:
/* @var Response $response */
$response = $this->render('SonataAdminPrintBundle::list__action_print.html.twig', [
'action' => 'print',
'object' => $object,
'elements' => $this->admin->getShow(),
]);
could you please check that tomorrow, would be great :smile:
Will do.
looks like its working, but this is the result oO
I think it uses the show field data fro your admin, which is not mandatory.
i have show fields, but it looks like it uses the template which is used in the List for the Action!
"Drucken" comes from the translation file from the button action_print
Hm, looks like the template must also be configured. Here is my admin service definition:
services:
szerviz.admin.issue:
class: SzervizBundle\Admin\IssueAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "Szerviz", label: "Issue" }
arguments:
- ~
- SzervizBundle\Entity\Issue
- SzervizBundle:Issue
calls:
- [ setTranslationDomain, [SzervizBundle]]
- [ setTemplate, [print, SonataAdminPrintBundle::print.html.twig]]
ok, but why do we then need the Configuration part?
I can't recall. :stuck_out_tongue:
You need to configure to templates: one for the action itself (with the print button) and the PDF template. I remember having a hard time with this, as sonata configuration can't really be extended with this.
Is this still a thing?
Is this still a thing?
I think yes, will try this when i find some time!
I have the same issue , an error message that say : Unable to find template "SonataAdminPrintBundle::list__action_print.html.twig"
i got this error:
any idea @sagikazarmark