indigophp / sonata-admin-print-bundle

Allows to print entities
https://indigophp.com
MIT License
1 stars 1 forks source link

template not found #5

Open OskarStark opened 8 years ago

OskarStark commented 8 years ago

i got this error: bildschirmfoto 2016-01-14 um 17 07 45

any idea @sagikazarmark

sagikazarmark commented 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.

OskarStark commented 8 years ago

i did this:

            ->add('_action', 'actions', array(
                'actions' => array(
                    'show' => array(),
                    'edit' => array(),
                    'delete' => array(),
                    'print' => array(
                        'template' => 'SonataAdminPrintBundle::list__action_print.html.twig',
                    ),
                )
            ))
OskarStark commented 8 years ago

or what do you mean?

sagikazarmark commented 8 years ago

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.

OskarStark commented 8 years ago

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)
sagikazarmark commented 8 years ago

Oh shit, that's JMS translation bundle. You have to install that for now. But I already planned to kill that stuff.

OskarStark commented 8 years ago

check :)

OskarStark commented 8 years ago

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:

sagikazarmark commented 8 years ago

Will do.

OskarStark commented 8 years ago

looks like its working, but this is the result oO

bildschirmfoto 2016-01-14 um 20 37 24
sagikazarmark commented 8 years ago

I think it uses the show field data fro your admin, which is not mandatory.

OskarStark commented 8 years ago

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

sagikazarmark commented 8 years ago

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]]
OskarStark commented 8 years ago

ok, but why do we then need the Configuration part?

sagikazarmark commented 8 years ago

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.

sagikazarmark commented 7 years ago

Is this still a thing?

OskarStark commented 7 years ago

Is this still a thing?

I think yes, will try this when i find some time!

midoox92 commented 7 years ago

I have the same issue , an error message that say : Unable to find template "SonataAdminPrintBundle::list__action_print.html.twig"