Skip to content

Kévin Dunglas

Founder of Les-Tilleuls.coop (worker-owned cooperative). Creator of API Platform, FrankenPHP, Mercure.rocks, Vulcain.rocks and of some Symfony components.

Menu
  • Talks
  • Resume
  • Sponsor me
  • Contact
Menu

Making the Sonata Project better

Posted on December 10, 2013January 12, 2014 by Kévin Dunglas

As a freelancer and with my company, Les-Tilleuls.coop, I built many applications relying on Sonata bundles for Symfony. I especially recommend the Admin generator and the Media manager.

As these components help me to build apps with ease and speed, it’s a fair reward to contribute back to them when I can. In addition to being the author and maintainer of the Doctrine MongoDB ODM compatibility layer of the Admin Bundle ; I’ve recently added some useful features to the Sonata Project and it’s time to give them more exposure.

ACL editor for the Admin Bundle

Sonata ACL editor

The ACL component of the Symfony framework is as powerful as complicated. The Sonata Admin bundle provides a useful integration with it allowing to restrict actions to authorized users only. What was missing was an interface to set the permissions. I’ve fixed that and this ACL editor is now provided with the Admin bundle. This is now matter of a click for an admin to give rights to users on entities.

If you want to use this feature in your project, refer to the Sonata Admin documentation that have been updated accordingly.

ACL list filtering for the admin

This is a perfect complement to the ACL editor previously described.

I’ve built a bundle called CoopTilleulsAclSonataAdminExtensionBundle (distributed separately) providing a Sonata admin extension that filter lists of entities. Only entities that the logged in user as the right to interact with are displayed.

It also works with the ACL system of the Symfony security component. The documentation is provided with the bundle.

Confirm dialog to avoid losing unsaved changes

Sonata confirm on exit

A common pitfall with web apps is that when a link is clicked, unsaved data entered in a form is loose without warning. Thanks to the integration of my small confirmExit plugin for jQuery, the Sonata Admin no longer suffers of this flaw. This feature can be disabled through a configuration parameter.

My jQuery plugin internally use the useful Window.onbeforeunload Javascript event.

Integration of Sonata Media in CKEditor

Sonata integration in CKEditor

The Sonata Media manager is the most powerful way to manage images, videos and files in Symfony powered applications. It supports YouTube, Vimeo and Dailymotion videos out of the box, image thumbnail generation and Amazon S3, FTP and CDN storage systems. It is highly extendable and is provided with a customized Sonata Admin UI.

What I missed was the ability to select and upload Media directly from CKEditor, the popular WYSYWG visual text editor. Those features is now available as a separate bundle (when I have time, I’ll move it directly in the SonataMedia bundle). The CoopTilleulsCKEditorSonataMediaBundle bundle allows to:

  • Upload an image through Sonata Media directly form the CKeditor’s image dialog
  • Select an existing Sonata Media file
  • Create a link to a media handled with Sonata through the CKeditor’s link button
  • Upload a file from the CKEditor’s link dialog

As always, the doc is included with the bundle.

I’ve also make some bug fixes on SonataAdmin, SonataMedia, SonataPage and SonataDoctrineORMAdminBundle. Hoping these enhancements will help some Symfony developers!

Related posts:

  1. New release of the ACL extension for Sonata Admin
  2. Une doc (spartiate) pour le support MongoDB de l’admin Sonata pour Symfony 2
  3. Making the Symfony PropertyAccess Component 84% faster in 2.8… and counting
  4. DunglasTorControlBundle, TorControl Symfony integration

2 thoughts on “Making the Sonata Project better”

  1. iSam says:
    February 10, 2014 at 12:27 pm

    Hi there,

    The ACL editor is really great, thanks for it 😉

    I want to manage rights per user groups, or per ACL roles, instead of per user as it’s now. Do you know how to do this?

    Thanks

    Reply
    1. Kévin Dunglas says:
      February 11, 2014 at 11:08 am

      Hi iSam,

      Groups and roles are not currently supported in the UI. However, I’ve built a command to set them. It is currently awaiting to be merged in Symfony: https://github.com/symfony/symfony/pull/9990

      You can inspire you from the command’s code to enhance the UI. If you manage to get something cool, send a PR to the Sonata Admin GitHub repository!

      Reply

Leave a ReplyCancel reply

Social

  • Bluesky
  • GitHub
  • LinkedIn
  • Mastodon
  • X
  • YouTube

Links

  • API Platform
  • FrankenPHP
  • Les-Tilleuls.coop
  • Mercure.rocks
  • Vulcain.rocks

Subscribe to this blog

Top Posts & Pages

  • JSON Columns and Doctrine DBAL 3 Upgrade
  • Securely Access Private Git Repositories and Composer Packages in Docker Builds
  • Preventing CORS Preflight Requests Using Content Negotiation
  • FrankenPHP: The Modern Php App Server, written in Go
  • Symfony's New Native Docker Support (Symfony World)
  • Develop Faster With FrankenPHP
  • How to debug Xdebug... or any other weird bug in PHP
  • HTTP compression in PHP (new Symfony AssetMapper feature)
  • Goroutines, threads, and thread IDs
  • PHP and Symfony Apps As Standalone Binaries

Tags

Apache API API Platform Buzz Caddy Docker Doctrine FrankenPHP Go Google GraphQL HTTP/2 Hydra hypermedia Hébergement Javascript JSON-LD Kubernetes La Coopérative des Tilleuls Les-Tilleuls.coop Lille Linux Mac Mercure Mercure.rocks Messagerie Instantanée MySQL performance PHP Punk Rock Python React REST Rock'n'Roll Schema.org Security SEO SEO Symfony Symfony Live Sécurité Ubuntu Web 2.0 webperf XML

Archives

Categories

  • DevOps (84)
    • Ubuntu (68)
  • Go (17)
  • JavaScript (46)
  • Mercure (7)
  • Opinions (91)
  • PHP (170)
    • API Platform (77)
    • FrankenPHP (9)
    • Laravel (1)
    • Symfony (97)
    • Wordpress (6)
  • Python (14)
  • Security (15)
  • SEO (25)
  • Talks (46)
© 2025 Kévin Dunglas | Powered by Minimalist Blog WordPress Theme