Commit eedf4a93 authored by idebr's avatar idebr Committed by frjo
Browse files

Issue #2169461 by idebr: Added Allow Colorbox image attributes to be overridden before rendering.

parent dac73fc3
...@@ -43,6 +43,22 @@ function theme_colorbox_image_formatter($variables) { ...@@ -43,6 +43,22 @@ function theme_colorbox_image_formatter($variables) {
$image['attributes'] = $item['attributes']; $image['attributes'] = $item['attributes'];
} }
// Allow image attributes to be overridden.
if (isset($variables['item']['override']['attributes'])) {
foreach (array('width', 'height', 'alt', 'title') as $key) {
if (isset($variables['item']['override']['attributes'][$key])) {
$image[$key] = $variables['item']['override']['attributes'][$key];
unset($variables['item']['override']['attributes'][$key]);
}
}
if (isset($image['attributes'])) {
$image['attributes'] = $variables['item']['override']['attributes'] + $image['attributes'];
}
else {
$image['attributes'] = $variables['item']['override']['attributes'];
}
}
$entity_title = entity_label($entity_type, $entity); $entity_title = entity_label($entity_type, $entity);
switch ($settings['colorbox_caption']) { switch ($settings['colorbox_caption']) {
......
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