Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have something like the following:
<?php
function studiosundew_token_values($type, $object = NULL) {
$values = array();
switch ($type) {
case 'node':
$node = $object;
$random_image = views_embed_view('random_image');
$values['image-view'] = $random_image;
break;
}
return $values;
}
?>
And I'm using the token filter module so I can add tokens like [token node image-view]
into my node content. This works and a random image appears in my node. ALMOST perfect!
Any pointers as to how I can make it so that I can have multiple [token node image-view]
s in each node, each one returning a new random image? At the moment, it simply repeats the same image.
Many thanks.
Comments
Comment #1
mshepherd CreditAttribution: mshepherd commentedI got this working with multiple tokens, rather than multiple uses of the same token. So, tokens like [token node randomimage1], [token node randomimage1] and [token node randomimage3].
Comment #2
Dave Reid