sonata-admin

Modifying list view in Sonata

风流意气都作罢 提交于 2019-12-06 16:07:47
I'm using SonataAdminBundle for a Symfony project and I want to list entities not in table, but using vertical tabs. So, I want to have a tab, corresponding to each entity, so that pushing this tab opens fields selected by configureListFields at the right. Is sonata capable of it? Thanks for your help. As mentionned on the SonataAdmin documentation , it is possible override the default templates Sonata uses to render the admin UI: sonata_admin: templates: list: SonataAdminBundle:CRUD:list.html.twig inner_list_row: SonataAdminBundle:CRUD:list_inner_row.html.twig ... The list template is

One to Many relations and add/edit form in SonataAdmin and Symfony2

耗尽温柔 提交于 2019-12-06 15:06:24
问题 I have a simple Symfony2 application with two entities: Municipality and Poi. There is a relation "One-To-Many" between Municipality and Pois (i.e: zero or more pois placed in one municipality), so the Entity files are like this: Poc\PocBundle\Entity\Municipality.php <?php // Poc\PocBundle\Entity\Municipality.php namespace Poc\PocBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Municipality * * @ORM\Table() * @ORM\Entity(repositoryClass="Poc\PocBundle\Entity\MunicipalityRepository") */

Custom Template in Sonata Admin

女生的网名这么多〃 提交于 2019-12-06 14:34:36
I am using Sonata Admin to manage CRUD tasks in my application. In one Admin called Multimedia, which has one-to-many relations with Files and Weblinks, both of which are embedded in the Multimedia form. I have a custom template that renders the fields horizontally and with titles. My question is, do I have to specify two different templates for Files and Weblinks because using a single file has failed, Files renders the embed form how I want it but weblink ignores directive. Here's the Admin Code class MultimediaAdmin extends Admin { // Fields to be shown on create/edit forms protected

List Images in sonata admin bundle

会有一股神秘感。 提交于 2019-12-06 09:49:53
问题 I am new to Symfony & trying to list images in sonata admin bundle. But i am bit confuse how to get an object in twig file so that i can get my exact path for image source. here is my code protected function configureListFields(ListMapper $listMapper) { // $image = $this->getSubject(); $listMapper ->addIdentifier('caption') ->add('image','string', array('template' => 'swaamImageUploaderBundle:Admin:list_image.html.twig')) ; } and here is my list_image.html.twig file {% extends

Access POST data from a form in SonataAdmin

假装没事ソ 提交于 2019-12-06 09:05:49
I have a simple question, how can I access the raw POST data returned by a form in sonataAdmin? I have a page that is creating forms using Javascript and I need to retrieve the data in those forms. The problem is that those forms are not attributes of the entity so I can't have Sonata admin linking them automatically for me. The base admin class provides a getRequest method which returns the Request object. Something like... $request = $this->getRequest(); $postValue = $request->request->get('parameterName'); There even seems to be "smarter" and may be more secure version: public function

How to get images listed in sonata admin bundle backend

元气小坏坏 提交于 2019-12-06 08:58:40
I want to get my image thumbnail listed in list area, i don't know how to do that, can any one please help me. I Got my caption in back end. I am using Sonata adim bundle and following its official document. here is my imageAdmin.php namespace swaam\ImageUploaderBundle\Admin; use Sonata\AdminBundle\Admin\Admin; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Form\FormMapper; class ImageAdmin extends Admin { // Fields to be shown on create/edit forms protected function configureFormFields(FormMapper $formMapper) { $formMapper -

How to add an array (customisable) to a symfony2 form (with sonata Admin)?

浪子不回头ぞ 提交于 2019-12-06 07:35:09
问题 I have a simple form with Sonata admin. I would like the user could add a list of integers (as many as he wants). And after it would be store as an array in my object: [1, 2, 3, 6, 9] There any way of doing it without creating another class to instantiate the integers? UPDATE: The only way I know how to something close is using choice like: ->add('type', 'choice', [ "required" => true, "expanded" => true, "multiple" => false, "choices" => Campanha::getTypes(), ]) But with that I have a

Sonata admin bundle preview image from some entity in list mapper without sonata media bundle

梦想与她 提交于 2019-12-06 05:54:17
问题 I was wondering how should i approach this problem. In sonata admin dashboard i have users and i would like to preview users profile pictures in thumbnails of a ListMapper. I'm new to symfony and still a bit confused trying to wrap my head around these concepts. 回答1: You need to create a custom template where you display the image of your user, i will assume that your Entity User as a Picture Entity which has a path method that gives the image URL : picture.html.twig {% extends

ACL + SonataAdminBundle + SonataUserBundle

▼魔方 西西 提交于 2019-12-06 05:47:31
In my Symfony2 project I managed to setup FOSUserBundle + SonataUserBundle + SonataAdminBundle following official docs. Now comes the time to setup the ACL (Access control list). What I did : Created an AdminClass called AdminReport app/console sonata:admin:setup-acl install ACL for sonata.admin.report update role: ROLE_SONATA_ADMIN_REPORT_GUEST, permissions: ["LIST"] update role: ROLE_SONATA_ADMIN_REPORT_STAFF, permissions: ["LIST","CREATE"] update role: ROLE_SONATA_ADMIN_REPORT_EDITOR, permissions: ["OPERATOR","EXPORT"] created a new user, granted him with ROLE_SONATA_ADMIN_REPORT_STAFF app

How to translate labels in Sonata Admin Bundle

ぃ、小莉子 提交于 2019-12-06 05:12:27
I'm using Symfony 2.3 with Sonata Admin Bundle. I know that I can translate a label in this way: ->add('shortDescription', null, array('label'=>'shortDescriptionTranslated')) But this is possible only with "configureFormFields" method, not for dataGrid and listFields. Can you provide me a complete example for translating labels in global way? I have looked here ( Labels in Sonata Admin Bundle ) but I have no idea what to write in the xliff file. Thanks! Did you review the translation documentation from the Sonata Project website: http://www.sonata-project.org/bundles/admin/master/doc/reference