Regex Submit Form for Enter Submitted to...

Created on 21 February 2024, 4 months ago
Updated 18 April 2024, 2 months ago

Problem/Motivation

Hi, in the submission part of a webform, there is an input with the placeholder "Enter submitted to... which allows you to search different entity types to find the submissions concerned.

I noticed that if for example, an entity type which would be a node, had parentheses in its name (example: "NODE (23/2)"), the node sought would be 23/2 and not the id of the node.

Steps to reproduce

Create an attached entity type with parenthesis at the end of name.

Proposed resolution

Modifie the regex present in submitForm

- \( matches an opening parenthesis.

- [^()]+ matches one or more characters that are not opening or closing parentheses.

- \) matches a closing parenthesis.

- $ means the match should end at the end of the string.

This expression should always capture the content between the last parentheses without including the preceding parentheses.

If we dpm($matches) in the function submitForm() for the example "NODE (23/2)"

Before :
array:2 [β–Ό
0 => "(23/2)"
1 => "23/2"
]

After :
array:1 [β–Ό
0 => "node:598"
]

πŸ› Bug report
Status

Fixed

Version

6.2

Component

Code

Created by

πŸ‡«πŸ‡·France alexl

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024