feat!: replace $args arrays in widgets and mediapool with dedicated parameters#6594
Merged
Conversation
gharlan
marked this pull request as ready for review
July 22, 2026 21:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
$argsarrays on the fourgetWidget()methods (LinkVar,LinkListVar,MediaVar,MediaListVar) were a relic of the removed REX_VAR parser, which could inject arbitrary key-value pairs from module code. In practice, exactly three keys were ever consumed:category,typesandpreview. This PR replaces the arrays with dedicated, typed parameters — end to end:LinkVar/LinkListVartake?int $category;MediaVar/MediaListVartake?int $category, list<string> $types, bool $preview. The genericforeach ($args)URL forwarding is gone (also fixes the urlencode inconsistency between the two media widgets).Form\Field\ArticleField/MediaFieldand the two MetaInfo fields pass the values directly;Form\Field\MediaField::setTypes()now accepts alist<string>instead of a comma-separated string.MediaPool::isAllowedExtension()/getAllowedExtensions()andMediaHandler::addMedia()takelist<string> $typesinstead of the raw widget-args array (theaddMedia()parameter was misleadingly named$allowedExtensionsbefore).typesrequest param instead of the genericargs[]roundtrip through URLs and hidden fields. The comma-separated string is parsed exactly at the request boundaries (media.list.phpfilter,upload.php).BC break (intentional)
getWidget()signatures change; addons calling them (e.g. YForm) need to adapt when porting to 6.x.args[...]keys are no longer forwarded to the mediapool popup. This was a feature without consumers: no extension point in the mediapool ever received the args, they were only round-tripped.Obsolete PHPStan/Psalm baseline entries have been removed accordingly (no regeneration, only removals).
Verification
composer cs,composer sa,composer taintgreen;MediaPoolTestadapted (24/24 passing)?page=mediapool/media&types=jpg,pngshows the filter message, subpage links and the list/upload forms carry thetypesparam, upload validation receives it; without the param nothing leaks into URLs or forms