linderp / sulu-base-bundle
Helper classes and functions for sulu
Installs: 47
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/linderp/sulu-base-bundle
Requires
- php: ^8.2
- jackalope/jackalope-doctrine-dbal: ^2.0
- sulu/sulu: ^2.6
- symfony/config: ^6.2 | ^7.0
- symfony/dependency-injection: ^6.2 | ^7.0
- symfony/framework-bundle: ^6.2 | ^7.0
- symfony/http-foundation: ^6.2 | ^7.0
- symfony/http-kernel: ^6.2 | ^7.0
- symfony/intl: ^6.2 | ^7.0
- symfony/security-core: ^6.3 | ^7.0
- symfony/translation: ^6.2 | ^7.0
README
Shared Sulu CMS utilities for admin CRUD scaffolding, locale-aware repositories/controllers, and custom admin field types. Use this bundle from your app code to avoid reimplementing standard Sulu admin patterns.
What This Bundle Provides
- Admin CRUD base:
Admin/AdminCrud.phpplus config value objects for list/form/navigation setup. - Enable toggle:
Admin/AdminEnableToggle.php+Controller/Admin/EnableSwitch.phpfor standard on/off actions. - Locale-aware stack:
Entity/LocaleTrait.php,Repository/LocaleRepositoryUtil.php, andController/Admin/LocaleController.php. - List builder helper:
Common/DoctrineListRepresentationFactory.phpfor paginated list responses. - Content types:
Content/Types/*registered inResources/config/services.yaml. - Admin React fields:
Resources/js/src/components/content/types/*registered inResources/js/src/app.js.
Quick Start: Add a New Admin CRUD
- Admin class (extend
AdminCrud):- Implement
define()usingAdminCrudConfig+AdminCrudNavigationConfig+AdminCrudListConfig+AdminCrudFormConfig. - Implement
AdminEnableToggleif the entity has anenabledflag.
- Implement
- Controller (extend
BaseControllerorLocaleController):- Implement
getDataForEntity(),mapDataToEntity(),load(),create(),save(),remove(). - Use
EnableSwitchtrait if you added the enable toggle.
- Implement
- Repository:
- Extend
BaseRepositoryUtilfor plain entities orLocaleRepositoryUtilfor localized entities. - For
LocaleRepositoryUtil, implementappend()andappendSortByJoins()for list/smart content.
- Extend
Example: Minimal Admin Definition
final class EventAdmin extends AdminCrud { public static function define(): AdminCrudConfig { return new AdminCrudConfig( 'events', new AdminCrudNavigationConfig('app.events', 10, 'su-calendar'), new AdminCrudListConfig('app.events', 'events', 'app.events_list'), new AdminCrudFormConfig('title', 'app.events_add', 'app.events_edit', 'event_form') ); } }