No displays available when view name contains brackets

Created on 2 May 2018, about 6 years ago
Updated 14 June 2024, 14 days ago

When view contains a brackets in name there's no way to select display,
this happens because of following preg_match usage in ViewsReferenceTrait.php

preg_match('#\((.*?)\)#', $full_view_name, $match);

F.e., when view name is "Articles (Taxonomy)" , autocomplete widget will provide following text "Articles (Taxonomy) (articles)",
and regular expression match will pass "taxonomy" as a view id, because it's stops at first match.

As entity reference widgets are using pattern "[entity label] ([entity_id])" for autocompletion,
this problem can be solved by using preg_match_all and picking always the last match.
This will guarantee that getViewDisplay() method will aways recieve correct view id, so like this for example:

preg_match_all('#\((.*?)\)#', $full_view_name, $matches);
$match = end($matches);
πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland sandboxpl Poland πŸ‡΅πŸ‡±

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