alengo/alengo-webspace-settings-bundle

Webspace Settings Bundle

This package is auto-updated.

Last update: 2025-05-25 10:22:21 UTC


README

Sometimes you need to store values that are not directly related to a specific page or content type, but rather to the entire webspace. This Sulu bundle provides a way to manage such settings in a structured manner.

Screenshot of Sulu AlengoWebspaceSettingsBundle

Requirements

  • PHP 8.2
  • Symfony >=7.2

Install the bundle

Execute the following composer command

composer require alengo/alengo-webspace-settings-bundle

Enable the bundle

Enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

return [
    /* ... */
    Alengo\Bundle\AlengoWebspaceSettingsBundle\AlengoWebspaceSettingsBundle::class => ['all' => true],
];
bin/console do:sch:up --force

Configure the Bundle

Set the following config in your routes_admin.yaml

alengo_webspace_settings_api:
   type: attribute
   resource: Alengo\Bundle\AlengoWebspaceSettingsBundle\Controller\Admin\WebspaceSettingsController
   prefix: /admin/api
   name_prefix: alengo_webspace_settings.

Twig Extension

The bundle provides a Twig extension to render the webspace settings in your templates. You can use the webspaceSettings function to retrieve the settings for a specific webspace and typeKey.

{{ webspaceSettings('metaPublisher') }}

with localization

{{ webspaceSettings('metaTitleFallBack', app.request.locale) }}

Events

The bundle dispatches the following events:

  • WebspaceSettingsCreatedEvent
  • WebspaceSettingsUpdatedEvent

Create an event listener in your project to listen to these events and perform any necessary actions when webspace settings are created or updated. It is recommended to use the settings type Event.