MASSIVE ART_Niklas Natter_640x640
Niklas Natter
Core Developer – Sulu GmbH
Sulu Core Developer and Open-Source Enthusiast.
@niklasnatter
2021-05-27

Sulu Release 2.3.0

After about 6 months of development since the last minor version, we are thrilled to announce that we released Sulu 2.3.0 today! The release introduces a brand new activity log feature that allows users to see what is happening in the application and provides a way for developers to listen for changes and other events that happen in the system. Along with many other improvements, this release also adds new features to the page functionality, enhances the built-in form functionality, and improves consistency throughout the application. 

Central activity log and event hub

Allowing users to see the activities happening inside of a Sulu application is a frequently requested feature in our community. We are happy that Sulu 2.3.0 finally introduces an application-wide activity log to do exactly that. The new version includes a fresh “Activities” view in the “Settings” section of the navigation, that lists all changes that were made to all built-in entities such as pages, snippets and categories. The list includes a timestamp and the associated user for each activity.

In addition to the application-wide log, the new minor version also adds an entity-specific activity log for pages and media. This view allows the user to see what happened to a specific entity at what time. We have added this tab to page and media entities for now, but we are open to adding a similar view to other entities in the future. Feel free to reach out to us via GitHub, Slack or our contact form to add your thoughts on this.

Behind the scenes, the new activity log feature also brings great possibilities to developers. Each activity that is displayed to the user is created based on an event that was dispatched in the application. These events are dispatched using the Symfony event dispatcher and developers can easily listen and react to specific events using Symfony best practices in a project. For example, the following code allows developers to send an email to the product owner when a page with a specific template is created in the application:

class SendPageCreatedMailSubscriber implements EventSubscriberInterface
{
    /**
     * @var MailerInterface $mailer
     */
    private $mailer;
 
    public function __construct(MailerInterface $mailer) {
        $this->mailer = $mailer;
    }
 
    public static function getSubscribedEvents()
    {
        return [
            PageCreatedEvent::class => 'sendPageCreatedMail',
        ];
    }
 
    public function sendPageCreatedMail(PageCreatedEvent $event): void
    {
        if ('product' === $event->getPageDocument()->getStructureType()) {
            return;
        }
 
        $email = (new Email())
            ->from('from@example.com')
            ->to('to@example.com')
            ->subject('New product page created')
            ->text('Page Title: ' . $event->getPageDocument()->getTitle());
 
        $this->mailer->send($email);
    }
}

Similar functionality can easily be implemented for all activities that are displayed to the user in the activity log. This is especially useful for synchronizing data to other systems and makes the Sulu content management system even more flexible and extensible.

New features for pages

The block feature of Sulu increases flexibility for the content manager while keeping content structured and consistent. Sulu 2.2.0 introduced a block display settings functionality that allows you to display a block for a specific segment or for specific target groups only. With 2.3.0, we improved this feature and now allow the content manager to configure blocks to be displayed based on the current time or date. To make this feature easy to use, we even added a date selection to our preview that allows the content manager to see the rendered website for the specified date.

In addition to the improvements of the block display settings functionality, Sulu 2.3.0 also improves the handling of localized pages. Sulu was built with support for multilingual content from the start and allows users to change and publish content of different localizations independently. Starting with version 2.3.0, it is now possible to remove a specific locale from a page completely.

Enhance validation and conditions in forms

The form functionality of Sulu is one of the most central and most frequently used features of the content management system. It is not only used for managing pages and snippets, but it is also used for integrating custom entities and external systems into the Sulu administration interface. Sulu 2.3.0 refines this form functionality by solving a common pain point of using conditions inside of blocks, and significantly improves the validation functionality inside of forms.

Sulu allows the use of “disabledCondition” and “visibleCondition” attributes to disable or hide properties based on the values of other properties inside of page templates and form configurations. Until now, these conditions could only access data of root properties of a template and could not reference the data of properties of the same block instance. Accessing properties relative to the current block was a frequently requested feature by our community and we are happy that this is finally possible in Sulu 2.3.0 by using the “__parent” variable:

<type name="editor">
    <properties>
        <property name="hasImage" type="checkbox">
            <!-- ... -->
        </property>
 
        <property name="image" type="single_media_selection" visibleCondition="__parent.hasImage">
            <!-- ... -->
        </property>
    </properties>
</type>

Furthermore, the new minor release significantly improves the validation functionality inside of forms. In addition to correctly validating the “mandatory” attribute for all property types, the form view also allows specifying additional validation rules. All selection property types now support parameters for specifying a minimum and maximum number of selected items. Text properties allow to specify a minimum and maximum number of characters and also support validating the given value against a specified pattern. To explain validation rules and display additional information to the content manager, all form properties support the “info_text” element.

Other miscellaneous improvements

In addition to the new functionality and major improvements described above, Sulu 2.3.0 comes with many small improvements and tweaks in various areas. Here are some noteworthy changes:

  • Support for “Media Properties Provider” services to provide additional data for media, that can be accessed in the Twig template. For example, this can be used for extracting special metadata from images and videos.
  • Upload new files without navigating into a folder in the media overview and display a button for directly uploading files in the overlay of a media-selection.
  • Ability to use the varnish Xkey feature for more efficient cache invalidation.
  • Store creation date, creator, modification data and changer on user entity.
  • Disable collapsing and moving of blocks with the newly added “collapsable” and “movable” parameters inside of form configurations.
  • Refactor the autocomplete single-selection to be compatible with localized entities, and adjust the used data format to be consistent with all other single-selections.
  • Configure columns to shrink to their content with the newly added “width” attribute inside of list configurations.
  • Allow the user to filter contact, organization and media list by the associated categories.

Have a look at the release notes if you are interested in a list of all changes that made it into Sulu 2.3.0.

Call for community translations

Sulu, and its official bundles, include English and German translations for the administration interface out of the box. Additional languages can be added by configuring the desired language and copying the respective community translation file into the project as described in our Getting Started documentation. We are proud to see that our CrowdIn organization already contains translations for 14 different languages, all contributed and maintained by our awesome community. 

Sulu 2.3.0 comes with a lot of new translations that are used by the activity log functionality. We have included English and German translations out-of-the-box as usual, but there are still some translations missing for the languages that are maintained by the community via our CrowdIn organization. Feel free to check your preferred language for missing translations on CrowdIn - the Sulu team deeply appreciates any contribution! Also, please don't hesitate to contact us via Slack or the contact form on our Website if your preferred language is not yet listed on CrowdIn .

Upgrading your Project

We have put a lot of time and effort into the development of Sulu 2.3.0 and we are really happy with what we have achieved. We encourage everybody to profit from the included features and improvements by updating their project to the new release and are eagerly awaiting your feedback about it!

  • Upgrading your project to Sulu 2.3.0 should be straightforward in most cases.
  • The new version includes a new “SuluActivityBundle” that must be registered in your project.
  • Additionally, you will need to change the type of a column of the “AccessControl" entity.
  • You also need to add four additional columns to the “User” entity in your database.

Follow our Upgrading Sulu 2.x documentation when updating your project, and do not hesitate to reach out to use via GitHub, Slack or the contact form on our Website if you encounter any problems.

Your feedback is important

An active and supportive community is what makes an open-source product like ours sustainable. We need your feedback to make further improvements and develop a great product. Please do not hesitate to contact us via GitHub, Slack or our Website if you encounter any issues or have an idea for a new feature!

Finally, if you have not done it yet, don't hesitate to spread some love and leave Sulu a ⭐ on GitHub.