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.

Comments

kducharm created an issue. See original summary.

kducharm’s picture

Title: Using a field name token with caps a contextual argument does not pass to view » Using a field token with caps a contextual argument does not pass to child view
kducharm’s picture

Patch to include caps in regex

kducharm’s picture

Rerolled patch for 8.x-1.x-dev, last patch was for 8.x-1.0-beta2

kducharm’s picture

Status: Active » Needs review

The last submitted patch, 3: views_field_view-field_token_caps-2793785-3-D8.patch, failed testing.

The last submitted patch, 3: views_field_view-field_token_caps-2793785-3-D8.patch, failed testing.

jibran’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Let's add some tests for this.

sd9121’s picture

StatusFileSize
new583 bytes

Rerolled patch for 8.x-1.0-beta2

gg24’s picture

Assigned: Unassigned » gg24
Status: Needs work » Reviewed & tested by the community

Hi @sd9121,

I am able to apply the patch clearly and it works as expected.
Hence issuing RTBC.

Thanks!

gg24’s picture

Assigned: gg24 » Unassigned

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: using_a_field_token-2793785-9.patch, failed testing. View results