change default template for sfGuard admin module- symfony 1.4 - symfony-1.4

I'm using symfony 1.4 (the lexpress symfony 1.5 branch) and sfPropelORMPlugin with propel 1.6
I've updated my admin generator backend to use a bootstrap3 theme using this plugin:
https://github.com/bgcc/sfBootstrapPropelAdminThemePlugin
I set the admin to use this theme in the view.yml for each generated admin module.
thus:
generator:
class: sfPropelGenerator
param:
model_class: Modelname
theme: bootstrap
Can I set the theme globally for all admin modules somehow?
I've tried copying generator.yml into the application level config and just defining the template param but symfony wants a modelname.
Thanks.

It's not possible, but if you want to override plugin's module generator.yml, you just need to create app/appName/modules/sfGuardUser/config/generator.yml file and it will be used. Copy it from plugins/sfGuardPlugin/modules/sfGuardUser/config/generator.yml and adjust. Same for other modules.

Related

Sonata Admin (4.17 or higher) Override list__action_delete.html.twig globally

I want to do exactly this (see link below) - override the list__action_delete.html.twig template globally for the entire project.
But with the newer sonata-admin and symfony version (without the app-directory) I have no clue where to place the list__action_xxx.html.twig files
See:
SonataAdminBundle - rewrite action button teplates in config.yml

Symfony routing configuration I can't find documentation about used to work but now it doesn't

I usually see resource: contain a file path, but here I have a multiline string with yaml instead:
shop_admin_taxon:
resource: |
alias: sylius.taxon
section: shop
templates: AdminBundle:Taxon/Crud
except: ['show', 'index']
redirect: update
grid: shop_admin_taxon
type: sylius.resource
prefix: /
I didn't get any error messagaes about this code when it worked on Symfony 3.2.7 in another project. But now Symfony 3.4 gives me the following error when trying to read this configuration:
The file "alias: sylius.taxon section: shop templates: AdminBundle:Taxon" does not exist.
That's actually expected (since as far as I know you pass a resource locator to resource: and not the actual resource configuration), but why did it work?
Symfony is complex beast and allows a lot of tinkering with it's internals. The routing component is no exception of this and you can see usages which modify or even dynamically create routes on the fly.
This in particular looks like a Sylius extension to routing. If you are curious how precisely it works have a look at the relevant Symfony documentation page. The functionality is being provided by the SyliusResourceBundle with a custom loader.
With all this in mind it looks like you have a broken Sylius install as the custom routing loader is not working. It could be some version mismatch introduced by composer update (e.g. remove component A due to incompatibility with newer version of component B), or bundles not being enabled, or something similar. Make sure all Sylius bundles are installed and enabled

Symfony 4.1 Custom twig error template

I'm trying to override twig html error templates as per the symfony documentation
So I tried to override the views like for other third party bundles by creating the following files in 'templates/bundles/TwigBundle/Exception' :
error.html.twig
error404.html.twig
However the default html twig error templates show up when I trigger a 404 error in production mode.
Testing with the /_error/{statusCode} route in dev mode displays my custom templates correctly.
EDIT: I found out that it was an issue with FriendsOfSymfony/FOSRestBundle. Using composer require friendsofsymfony/rest-bundle dev-master solved the issue

Use bundle error templates in Symfony 3 app

I have a MyBundle bundle which I use in many Symfony applications.
This bundle provides common things which are shared across these applications, such as Controllers, Entities, templates, etc.
I would like the bundle to provide error templates as well.
I tried to put the templates in MyBundle/Resources/TwigBundle/views/Exception folder but the application does not use them.
When I copy TwigBundle folder from MyBundle/Resources into app/Resources then the templates are used as expected. However I do not want to copy the templates into every application's app/Resources folder.
Is it possible to override error templates using MyBundle/Resources instead of app/Resources?
TwigBundle always by default checks directory app/Resources/TwigBundle/views/Exception/ for templates.
If you want to use custom directory you have to override ExceptionController.
You can do this in config
// app/config/config.yml
twig:
exception_controller: MyBundle:Exception:showException
Default Twig ExceptionController can be found here.
Documentation

how to override FOSUserBundle's schema file in other bundle

I'm working in symfony 2.5 with propel for my project.
I need to add a behavior to fos_user table so I need a way to override the original schema file in my src/ directory. Defining my project as a child of FOSUserBundle does work but this is not what I want.
Is there another way?
you can copy the original schema file to your app directory
and add the behavior you need. The way is exactly like overriding
any twig templates from vendors.

Resources