Skip to content

Add new "type" parameter to Html::scriptBlock() - #26299

Merged
trasher merged 1 commit into
glpi-project:mainfrom
AdrienClairembault:script-block-type
Nov 13, 2026
Merged

trasher merged 1 commit into
glpi-project:mainfrom
AdrienClairembault:script-block-type

Conversation

@AdrienClairembault

Copy link
Copy Markdown
Member

Add new "type" parameter to Html::scriptBlock(), which allow scripts with type="module" or type="importmap" to be generated by this method.

This is important for CSP as we need all scripts to come from the same method so we can easily add the "nonce" parameter used to whitelist scripts.

Extracted from #26020 to simplify reviews.

@AdrienClairembault

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Powered by Qodo

@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Script blocks can now specify JavaScript, module, or import map types, enabling pages to include different kinds of scripts.
    • Existing script blocks continue to use the standard JavaScript type by default.

The change adds the ScriptType enum with JavaScript, module, and import-map values. Html::scriptBlock accepts an optional enum value and uses it for the script tag’s type. Functional tests cover the default and each supported type.

Suggested reviewers: cedric-anne, cconard96

Merge Risk: Minimal · up to 13d87

This adds an optional script type to Html::scriptBlock. Existing callers produce the same output as before, and no merge-blocking risk was found.

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

src/Html.php

ast-grep output exceeded the maximum buffer for this file

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@trasher
trasher merged commit 367a5c6 into glpi-project:main Nov 13, 2026
15 checks passed
@AdrienClairembault
AdrienClairembault deleted the script-block-type branch November 13, 2026 08:38
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.

2 participants