Commit 3f6b2640 authored by podarok's avatar podarok

Issue #155588 by frjo, benjy, znerol

parent 5c27b83d
......@@ -17,6 +17,7 @@
* @ingroup themeable
*/
function theme_colorbox_image_formatter($variables) {
static $gallery_token = NULL;
$item = $variables['item'];
$entity_type = $variables['entity_type'];
$entity = $variables['entity'];
......@@ -123,6 +124,16 @@ function theme_colorbox_image_formatter($variables) {
$gallery_id = '';
}
// If gallery id is not empty add unique per-request token to avoid images being added manually to galleries.
if (!empty($gallery_id)) {
// Check if gallery token has alrady been set, we need to reuse the token for the whole request.
if (is_null($gallery_token)) {
// We use a short token since randomness is not critical.
$gallery_token = drupal_random_key(8);
}
$gallery_id = $gallery_id . '-' . $gallery_token;
}
if ($style_name = $settings['colorbox_image_style']) {
$path = image_style_url($style_name, $image['path']);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment