Skip to content

Kévin Dunglas

Founder of Les-Tilleuls.coop (worker-owned cooperative). Creator of API Platform, 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 Reply Cancel reply

Follow me on Twitter

My Tweets

Subscribe to this blog

Recent Posts

  • New in Caddy 2.5: Redact Sensitive Data from Your Logs
  • Building Decentralized Web Apps with Solid and PHP
  • JSON Columns and Doctrine DBAL 3 Upgrade
  • Preventing CORS Preflight Requests Using Content Negotiation
  • Symfony’s New Native Docker Support (Symfony World)

Top Posts & Pages

  • Generate a Symfony password hash from the command line
  • JSON Columns and Doctrine DBAL 3 Upgrade
  • Using the "103 Early Hints" Status Code in Go Applications
  • Building Decentralized Web Apps with Solid and PHP
  • React ESI: Blazing Fast SSR
  • Installing a LaTeX environment on a Mac
  • Symfony 4: HTTP/2 Push and Preloading
  • Using Next.js and Material UI Together
  • Symfony's New Native Docker Support (Symfony World)
  • API Platform 2.6: PHP 8 support, Next.js and Nuxt.js app generator, Caddy server, ActivityPub and much more!

Persistence in PHP with the Doctrine ORM

Persistence in PHP with the Doctrine ORM

Tags

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

Archives

Categories

  • DevOps (24)
  • Mercure (3)
  • Opinions (91)
  • Programming (178)
    • Android (5)
    • Go (11)
    • JavaScript (43)
    • PHP (136)
      • API Platform (60)
      • Symfony (89)
    • Python (14)
      • Django (5)
  • Security (15)
  • SEO (24)
  • Talks (37)
  • Ubuntu (68)
  • Wordpress (6)

Blogoliste

  • API Platform
  • Les-Tilleuls.coop
  • Mercure.rocks
  • Vulcain.rocks
© 2022 Kévin Dunglas | Powered by Minimalist Blog WordPress Theme