- πΊπΈUnited States daniel korte Brooklyn, NY
Re-roll for the 1.4 version
- πΊπ¦Ukraine kir.lazur@gmail.com Kiev
Here is new version of patch with slight change to simplify displaying the value for current field using appropriate token.
Change highlight:// We need special handling for the token destination type. if ($destination_type == 'custom') { $destination = $manager->replaceToken((is_array($destination) && isset($destination['custom']) ? $destination['custom'] : $destination), $replace_tokens, ['clear' => TRUE,<strong> 'field_name' => $field_name, 'delta' => $delta]</strong>);
It will allows to handle correct delta of current field with multiple values, like entity reference, with example token info like ['tokens']['current-field']['value']
if ($type == 'current-field' && $token == 'value' && isset($options['delta']) && isset($options['field_name'])) { $replacements[$original] = $$data['node']->get($options['field_name'])->get($options['delta'])->target_id;
- πΊπ¦Ukraine kir.lazur@gmail.com Kiev
here the latest version including tokens as well
- πΊπ¦Ukraine kir.lazur@gmail.com Kiev
updated version with needs-data for token
- πΊπΈUnited States daniel korte Brooklyn, NY
Re-roll including latest from #9. I havenβt tested #9, but it looks good from a quick look
- π¦πΊAustralia interlated
Doesn't work for my use case.
Logically
[paragraph:field_pb_image:0:entity:field_media_image:wide:url]
[paragraph:field_pb_image:1:entity:field_media_image:wide:url]A paragraph that contains multiple images.
With the logical template
[paragraph:field_pb_image:current-field:entity:field_media_image:wide:url]
I don't think that there is anything in drupal that does this.
- π¦πΊAustralia interlated
I added a commit replacing the token :delta: with the delta
$result_token = preg_replace('/:delta:/', ':' . $delta . ':', $token_text);
So that
[paragraph:field_pb_image:delta:entity:field_media_image:wide:url]
Works.