Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-6875: Implemented IsPreview View Matcher #288

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

alongosz
Copy link
Member

@alongosz alongosz commented Oct 23, 2023

Question Answer
JIRA issue IBX-6875
Required by ibexa/dashboard#26
Type feature
Target Ibexa version v4.6
BC breaks no

This PR proposes IsPreview View Matcher allowing to distinguish templates for the same view type and SiteAccess but preview or non-preview view. Alternatively this can be achieved by either creating separate view type or using Twig "ifs" like {% if parameters.editorial_mode %} (PB) or {% if isPreview %} (Core).

Consider the following configuration:

ibexa:
  system:
    default:
      content_view:
        full:
          my_view:
            template: '@ibexadesign/app/my_view.html.twig'
            match:
              Identifier\ContentType: [ my_content_type ]
              IsPreview: false

          my_preview:
            template: '@ibexadesign/app/my_preview.html.twig'
            match:
              Identifier\ContentType: [ my_content_type ]
              IsPreview: true

When viewing a content of my_content_type content type my_view.html.twig template would be used. When previewing that content my_preview.html.twig would be used. Tested with ibexa/dashboard feature but that could work with core preview feature as well and maybe provide value overall.

Review remark: magic - this is legacy namespace-based view matcher - it's dynamically created as long as this class exists in that namespace...

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (main).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review.

@alongosz alongosz added the Feature New feature request label Oct 23, 2023
@alongosz alongosz requested a review from a team October 24, 2023 09:07
@alongosz alongosz requested a review from a team November 6, 2023 11:56
@alongosz alongosz requested review from adamwojs and a team November 6, 2023 13:19
Base automatically changed from ibx-6630-allow-injecting-view-type-in-preview to main November 6, 2023 13:33
@alongosz alongosz force-pushed the ibx-6875-is-preview-view-matcher branch from 269f51f to b990728 Compare November 6, 2023 13:36
Co-Authored-By: Adam Wójs <adamwojs@users.noreply.github.com>
Copy link

sonarqubecloud bot commented Nov 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@alongosz
Copy link
Member Author

alongosz commented Nov 7, 2023

Merging to unblock ibexa/dashboard. Will be tested together with the Customizable Dashboard feature.

@alongosz alongosz merged commit 2708c2e into main Nov 7, 2023
22 checks passed
@alongosz alongosz deleted the ibx-6875-is-preview-view-matcher branch November 7, 2023 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature request Ready for QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants