Using a custom entity, I had field names such as voteId or firstName. In creating a child view using a contextual argument and trying to pass the argument from the parent view with a token such as :
{{ raw_fields.voteId }}
the value would not get passed. I traced it down to views_field_view\src\Plugin\views\field\View.php::getTokenArgument():
protected function getTokenArgument($token) {
// Trim whitespace and remove the brackets around the token.
preg_match('{{\s?(?<type>[a-z_]+)\.(?<id>[a-z_]+)\s?}}', $token, $match);
return [
'type' => $match['type'],
'id' => $match['id'],
];
}The regex match doesn't allow for caps.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | using_a_field_token-2793785-9.patch | 583 bytes | sd9121 |
| #4 | views_field_view-field_token_caps-2793785-4-D8.patch | 589 bytes | kducharm |
| #3 | views_field_view-field_token_caps-2793785-3-D8.patch | 621 bytes | kducharm |
Comments
Comment #2
kducharm commentedComment #3
kducharm commentedPatch to include caps in regex
Comment #4
kducharm commentedRerolled patch for 8.x-1.x-dev, last patch was for 8.x-1.0-beta2
Comment #5
kducharm commentedComment #8
jibranLet's add some tests for this.
Comment #9
sd9121 commentedRerolled patch for 8.x-1.0-beta2
Comment #10
gg24 commentedHi @sd9121,
I am able to apply the patch clearly and it works as expected.
Hence issuing RTBC.
Thanks!
Comment #11
gg24 commented