Payum Bundle : How to change the view of capture a

2019-07-02 03:58发布

问题:

I am using PAYUM Bundle for the payment gateway integration, and its basic example is working fine, But now I want integrate the payum bundle in application by changing the payum capture action layout and adding extra field payment detail entity.

PAYUM BUNDLE with AUTHORIZE.NET GATEWAY.

Please can anyone help me out.

Thanks all in advance.

回答1:

The payum templates is not kept in the bundle but in the payum lib itself. Standard templates inheritance does not work here.

There is no simple way to do so in version 0.9 (which is shipped with Sylius right now). You have to overwrite the whole CaptureAction class. In 0.10 it is possible to change templates by overwriting container parameters like for layout, or stripe js page.

In the sandbox you can find an example of layout modification



回答2:

You have to override views of PayumBundle.

How to do that?

You have to reproduce the folder structure of the bundle you want to override inside your /src/Path/To/Your/Bundle/Resources/views and place inside it the twig file you want to override.

Example

Let's say your bundle name is FooBundle and you want to override PayumBundle payment.twig.html (I'm just making an example, don't know if there's a file named that way). Let's say, also, that this twig is inside /vendor/Path/To/PayumBundle/Resources/views/Payment/payment.twig.html.

What you have to do is create inside /src/Path/To/Your/Bundle/Resources/views/Payment/payment.twig.html

Symfony2 will look, at first, into your bundle for overrided views: if any will took yours and ignore bundles one. Otherwise It will took bundle's one.