Output multiple values of a query param with repeating param name

Created on 9 March 2019, over 5 years ago
Updated 14 June 2023, about 1 year ago

Problem/Motivation

Right now the only way to output the url query parameters with multiple values is to use the bracket notation, e.g.

$options = [
  'query' => [
    'tag' => ['one', 'two'],
  ],
];

is output as

?tag[0]=one&tag[1]=two

As discussed in πŸ› Url only outputs the last value of a query parameter Needs work , this is a PHP-ism and not a web standard. An external system can require an URI to be in the format of

?tag=one&tag=two

Proposed resolution

Add a new item in the Url's options array that will provide the ability to output multiple values of a query argument by repeating the parameter name.

API changes

A new url option multi_value_query_output with values default and repeat.

Release notes snippet

Added a way to output multi-valued query arguments by repeating the parameter name.

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
RoutingΒ  β†’

Last updated 2 days ago

Created by

πŸ‡΅πŸ‡±Poland blazey

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024