Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sulu Content Extra Bundle Laravel Package

alengo/sulu-content-extra-bundle

Extends Sulu CMS 3.x Pages and Articles with an Additional Data tab, built-in entities, configurable mapping for localized/unlocalized fields, auto entity registration, navigation link markers, and sortable template groups. PHP 8.2+, Symfony 7.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Sulu CMS Alignment: Perfectly extends Sulu’s dimensioned-content architecture (Pages/Articles + DimensionContent entities) without violating its core patterns. The use of PrependExtensionInterface for entity extension is a clean, Sulu-native approach, avoiding custom Doctrine configurations.
  • Modular Design: Decouples data storage (JSON fields), UI integration (Additional Data tab), and template access (NavigationLink markers) into distinct components. This modularity allows selective adoption (e.g., disable navigation features while using JSON fields).
  • Configuration-Driven: Leverages YAML for field mapping (unlocalized_keys/localized_keys) and entity overrides, enabling zero-code changes for basic use cases while allowing deep customization (e.g., custom entities via page_class).
  • Template Compatibility: The NavigationLinkTypeResolver bypasses Sulu’s TemplateResolver to expose custom fields, ensuring template access without modifying Sulu’s core template system. This is critical for dynamic features like redirect tracking.

Integration Feasibility

  • Sulu 3.x Specificity: Hard dependency on Sulu 3.0.6+ (for Gedmo fixes) and Symfony 7.x limits flexibility but ensures stability. Projects using older versions would require manual patches.
  • Doctrine Workarounds: The bundle’s resolve_target_entities trick replaces Sulu’s original class references at container build time, eliminating proxy generation in production. This is a highly effective optimization but requires understanding of Doctrine’s proxy mechanics.
  • Form System Integration: Relies on Sulu’s XML-based form definitions, which is both a strength (consistent with Sulu’s admin UI) and a limitation (no dynamic form fields without XML). Projects must define page_additional_data.xml/article_additional_data.xml.
  • Auto-Registration: The PreviewFormViewBuilder auto-registers the Additional Data tab, but this could conflict with custom tab registrations. The bundle provides no built-in conflict resolution.

Technical Risk

  • Entity Override Conflicts:
    • Risk: If the project or another bundle already extends Page/Article via PrependExtensionInterface, the bundle’s overrides may cause class loading conflicts or unintended behavior.
    • Mitigation: Document override precedence in the project’s architecture guidelines and test with a custom entity class (e.g., page_class: App\Entity\CustomPage).
  • JSON Data Integrity:
    • Risk: No built-in validation for the additionalData JSON field. Malformed data could corrupt the database or break templates.
    • Mitigation: Implement form-level validation (e.g., JSON Schema in the XML form) or business logic hooks (e.g., Doctrine lifecycle callbacks).
  • Navigation Marker Dependencies:
    • Risk: The NavigationLinkEnhancer depends on Sulu’s page_link_dimension_content_enhancer. If Sulu changes this enhancer’s behavior (e.g., in a minor version), the bundle may break.
    • Mitigation: Monitor Sulu’s release notes and test against Sulu’s latest patch versions.
  • Performance Trade-offs:
    • Risk: Disabling auto_generate_proxy_classes in production is a double-edged sword. While it reduces deploy overhead, it shifts proxy generation to cache:warmup, which could increase deploy time for large projects.
    • Mitigation: Benchmark cache:warmup time in staging and consider parallelizing proxy generation if needed.
  • Localization Edge Cases:
    • Risk: Misconfiguring unlocalized_keys/localized_keys could lead to data duplication (e.g., localized fields stored unlocalized) or missing translations.
    • Mitigation: Add validation to the YAML config (e.g., using Symfony’s ConfigurableInterface) and document common pitfalls.

Key Questions

  1. Custom Entity Strategy:
    • Does the project already extend Page/Article? If so, how will the bundle’s PrependExtensionInterface integration interact with existing overrides? Should we disable the bundle’s entity extensions and use a custom page_class instead?
  2. JSON Validation Requirements:
    • Are there strict validation rules for the additionalData field (e.g., required fields, nested structure)? If so, how will we enforce them (form XML, Doctrine constraints, or application logic)?
  3. Navigation Marker Use Cases:
    • What specific use cases drive the need for sourceLink/sourceUuid? For example:
      • Redirect tracking in analytics?
      • Dynamic template logic (e.g., "Show a banner if this page links to a product")?
    • Will these markers need to be exposed in the admin UI (e.g., as metadata for link-type pages)?
  4. Performance Constraints:
    • Is cache:warmup time a critical path for deploys? If so, should we avoid disabling proxy generation or explore alternative optimizations (e.g., pre-generating proxies in CI)?
  5. Localization Workflow:
    • How will content editors handle localized vs. unlocalized fields? For example:
      • Will they need UI guidance (e.g., tooltips) to distinguish between the two?
      • Should we add a preview feature to show how fields are stored across languages?
  6. Future-Proofing:
    • Are there plans to extend this pattern to custom content types (e.g., Media, Product)? If so, the bundle’s design (configurable page_class/article_class) is a strength, but we may need to abstract the entity extension logic further.
  7. Backup/Restore:
    • How will the additionalData JSON field be handled in database backups/restores? JSON columns can be tricky with some migration tools.
  8. Testing Strategy:
    • What test coverage is needed for the bundle’s features? For example:
      • Unit tests for NavigationLinkEnhancer?
      • Integration tests for entity overrides?
      • End-to-end tests for the Additional Data tab?

Integration Approach

Stack Fit

  • Sulu CMS 3.x: The bundle is tightly coupled to Sulu 3.x’s architecture (Doctrine entities, form system, template resolution). It assumes:
    • Sulu’s dimensioned-content pattern (e.g., Page + PageDimensionContent).
    • Sulu’s XML form definitions (no Twig/Php form support).
    • Sulu’s template system (with the workaround for NavigationLinkTypeResolver).
  • Symfony 7.x: Aligns with Sulu 3.x’s Symfony version but may require adjustments if using newer Symfony features (e.g., attribute routing, beyond #[Route]).
  • PHP 8.2+: Leverages modern PHP features (e.g., named arguments, union types) but avoids cutting-edge syntax that could complicate maintenance.

Migration Path

  1. Preparation Phase:
    • Audit Sulu Version: Verify compatibility with Sulu 3.0.6+ (check composer.json and config/packages/sulu.yaml).
    • Backup Database: Ensure a recent backup is available before making schema changes (though the bundle is non-destructive).
    • Review Custom Entities: Identify if the project extends Page/Article and document conflicts.
  2. Installation:
    • Add the bundle to composer.json:
      composer require alengo/sulu-content-extra-bundle
      
    • Register the bundle in config/bundles.php:
      Alengo\SuluContentExtraBundle\AlengoContentExtraBundle::class => ['all' => true],
      
    • Disable proxy generation (recommended for production):
      # config/packages/prod/doctrine.yaml
      when@prod:
          doctrine:
              orm:
                  auto_generate_proxy_classes: false
      
  3. Configuration:
    • Define field mappings in config/packages/alengo_content_extra.yaml:
      alengo_content_extra:
          page:
              form_key: page_additional_data
              unlocalized_keys:
                  - template_theme
              localized_keys:
                  - notes
          article:
              enabled: true
      
    • Create form definitions (required):
      mkdir -p config/forms
      touch config/forms/page_additional_data.xml
      touch config/forms/article_additional_data.xml
      
      Example page_additional_data.xml:
      <form xmlns="...">
          <key>page_additional_data</key>
          <properties>
              <property name="template_theme" type="select" mandatory="false">
                  <meta><title lang="en">Theme</title></meta>
                  <params><param name="values" type="collection"><param name="default" type="collection"><param name="title" value="Default"/><param name="name" value="default"/></param></param></params>
              </property>
          </properties>
      </form>
      
  4. Testing:
    • Functional Tests: Verify the Additional Data tab appears in the admin UI for Pages/Articles.
    • Data Storage: Test that fields are
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony