alengo / alengo-webspace-settings-bundle
Webspace Settings Bundle
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:sulu-bundle
Requires
- php: ^8.2
- ext-iconv: *
- sulu/sulu: ^2.6
- symfony/config: ^7.2
- symfony/dependency-injection: ^7.2
- symfony/framework-bundle: ^7.2
- symfony/http-foundation: ^7.2
- symfony/http-kernel: ^7.2
- symfony/serializer: ^7.2
- symfony/twig-bundle: ^7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.9
- handcraftedinthealps/zendsearch: ^2.0
- jackalope/jackalope-doctrine-dbal: ^1.10 || ^2.0
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.4
- phpstan/phpstan-doctrine: ^1.2
- phpstan/phpstan-phpunit: ^1.0
- phpstan/phpstan-symfony: ^1.1
- phpstan/phpstan-webmozart-assert: ^1.0
- phpunit/phpunit: ^9.5
- rector/rector: ^1.0.3
- sulu/sulu-rector: ^1.0.0
- symfony/browser-kit: ^7.2
- symfony/console: ^7.2
- symfony/dotenv: ^7.2
- symfony/error-handler: ^7.2
- symfony/monolog-bundle: ^3.1
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.
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
.