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

DRAFT: Closes #7063: Google font - Frontend part #7091

Open
wants to merge 1 commit into
base: feature/3.18
Choose a base branch
from

Conversation

Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Nov 6, 2024

Description

Fixes #7063

This code allows users to use locally stored Google Fonts on the front end instead of the online ones. It rewrites the Google Fonts paths into the local ones, keeping the original structure as data-wpr-hosted-gf-parameters argument. It also handles V1 and V2 separately, saving and printing two separate CSS files if both are inside the source at the same time. The feature adds its markup just after the OCI feature preloads and prints data correctly when used on the multisite.

Type of change

  • New feature (non-breaking change which adds functionality).

Detailed scenario

N/A

Technical description

Documentation

The code introduces a new namespace Media\Fonts with four classes: Subscriber, Controller, Context, and ServiceProvider. The Subscriber class uses the rocket_buffer filter to add the markup to the page. The Controller class rewrites the CSS to the page and checks if the feature is available. The Context class implements ContextInterface to determine if the feature is allowed. The ServiceProvider class registers the created classes.

New dependencies

No new dependencies are required for this change.

Risks

N/A

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

@Miraeld Miraeld self-assigned this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant