sonata

Use Sonata Field Type on normal Form Class

青春壹個敷衍的年華 提交于 2019-12-21 05:32:10
问题 I'm trying to insert custom sonata form field type on the front page, not in SonataAdmin, something like this: $form = $this->createFormBuilder($content) ->add('titleEs', 'text', array('required' => true, 'label' => 'label.title.spanish', 'attr' => array('class' => 'col-xs-12 form-control input-lg'))) ->add('contentEs', 'ckeditor', array('required' => true,'label' => 'label.content.spanish', 'attr' => array('class' => 'col-xs-12'))) ->add('titleEn', 'text', array('required' => true,'label' =>

Sonata admin bundle, manipulate objects

蹲街弑〆低调 提交于 2019-12-20 07:14:19
问题 I have 2 entities with one to many relationship project and prototype And I've been looking for a way to list the prototypes that belong to a project in the show action . here is my project entity: <?php namespace AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Projet * * @ORM\Table() * @ORM\Entity(repositoryClass="AppBundle\Entity\ProjetRepository") */ class Projet { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */

Sonata media validation at admin

末鹿安然 提交于 2019-12-14 00:27:57
问题 I'm trying to validate image. I saw answer at Sonata Media: The file could not be found How to validate image (width and height). I need help on that. There is no proper doc in net. 回答1: To validate image dimensions using sonata media you need to override sonata media's ImageProvider class, sonata uses this class to handle image manipulation.If you already have an extended bundle of sonata media bundle then in services.yml file you can define your own provider as below ,make sure your yml

Sonata Admin List Field Template is Ignored

ⅰ亾dé卋堺 提交于 2019-12-11 20:55:24
问题 I'm using Symfony 4.1.1 and Sonata Admin Bundle 3.35.2. I want to use a custom template for a field in an admin's list view. The template is ignored. I am using Twig as my templating engine. In the admin: # /src/Admin/ImageAdmin.php protected function configureListFields(ListMapper $listMapper) { $listMapper ->add('filename', 'string', ['template' => 'list_image.html.twig']) ; } The template: # /templates/list_image.html.twig {% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %} {%

SetTemplate in services.yaml doesn't work with my own template

孤街醉人 提交于 2019-12-11 16:29:37
问题 I have a Sonata Admin and I wanna replace his template with another one, but doesn't work, currently my app is running in Symfony 4.3 and the folder structure changes with symfony version and I don't know if my error is in that place. admin.expediente_compra: class: App\Admin\ExpedienteCompraAdmin arguments: [~, App\Entity\ExpedienteCompra, App\Controller\ExpedienteCompraAdminController] calls: - [setTemplate, ['edit', 'ExpedienteCompra/edit.html.twig']] tags: - { name: sonata.admin, manager

Sonata Admin + Vich Upload inject on load not working

…衆ロ難τιáo~ 提交于 2019-12-11 11:25:34
问题 i am using vich upload with sonata admin & i can able to upload & delete file my issue is i am not able to get uploaded file information i used vich uploader config "inject_on_load" as true vich_uploader: db_driver: orm # or mongodb or propel or phpcr mappings: small_image: uri_prefix: /uploads/images/small upload_destination: %kernel.root_dir%/../web/uploads/images/small namer: vich_uploader.namer_uniqid inject_on_load: true delete_on_update: true delete_on_remove: true now when i dump my

SonataAdmin child admin route visible in debug but not found

南楼画角 提交于 2019-12-11 07:20:46
问题 php bin/console debug:router |grep postboxmessage pt__RG__admin_mea_postbox_postboxmessage_list ANY ANY ANY /admin/mea/postbox/postboxmessage/list pl__RG__admin_mea_postbox_postboxmessage_list ANY ANY ANY /pl/admin/mea/postbox/postboxmessage/list en__RG__admin_mea_postbox_postboxmessage_list ANY ANY ANY /en/admin/mea/postbox/postboxmessage/list pt__RG__admin_mea_postbox_postboxmessage_create ANY ANY ANY /admin/mea/postbox/postboxmessage/create pl__RG__admin_mea_postbox_postboxmessage_create

Sonata Admin + show all items on list view (not per page)

☆樱花仙子☆ 提交于 2019-12-11 06:34:56
问题 In the Sonata Admin Bundle you have a list view where you can add fields you want to show in your table. At the bottom of the table you have the number of results and pagination. I like the pagination and items per page. But I would like to show ALL the items at the load of the page. So all the items are shown on the page but you can still choose to decrease the number of results per page. The problem is I don't have a clue on how to do this. Can someone set me on my way? 回答1: In SonataAdmin

change row color in sonata admin bundle dependent on a value of a field

老子叫甜甜 提交于 2019-12-11 02:55:18
问题 I have the sonata admin bundle and can't figure out, how to change a styling dependent on a field value in a form template. for example field difficulty ... the higher the difficulty value is, the more red colored the record row should be ... How can i do this? I spend hours to understand the twig templates in sonata, but the more i read this templates, the more i get confused. There are block calls amongst a template and its not possible to figure out, where this calls leading to or come

Hide download button in sonata admin

我只是一个虾纸丫 提交于 2019-12-11 00:13:59
问题 I would like to hide "Download" button on Sonata Admin from some of custom entity. How to hide/delete it? If i override base_list.html.twig and remove the download button from table_footer, it disappears all of entity lists. Is there any way to hide it from Admin class? 回答1: You can hide the "download" button by removing the corresponding route: class YourClass extends AbstractAdmin { public function configureRoutes(RouteCollection $collection) { $collection->remove('export'); } } 回答2: