Drupal 7 Photosweep设置带有html代码的图像标题
我正在使用drupal7 Photosweep模块,它使用Photosweep jQuery插件构建视图并显示照片库。 目前Photosweep只允许将图像标题显示为图像标题 另外,为了显示来自同一内容节点的其他文本字段,我将内容文本字段添加到视图中,并将其显示更改为添加CSS类(.photo_text) 然后我修改了photosweep.jquery.js中的openphotosweep函数,以获取图像父html节点($image.parents(“td:first”)),并选择它的具有(.photo_text)CSS类的子级,将它们添加为图像标题Drupal 7 Photosweep设置带有html代码的图像标题,drupal-7,photoswipe,Drupal 7,Photoswipe,我正在使用drupal7 Photosweep模块,它使用Photosweep jQuery插件构建视图并显示照片库。 目前Photosweep只允许将图像标题显示为图像标题 另外,为了显示来自同一内容节点的其他文本字段,我将内容文本字段添加到视图中,并将其显示更改为添加CSS类(.photo_text) 然后我修改了photosweep.jquery.js中的openphotosweep函数,以获取图像父html节点($image.parents(“td:first”)),并选择它的具有(.p
openPhotoSwipe: function(index, galleryElement, options) {
var pswpElement = $('.pswp')[0];
var items = [];
options = options || Drupal.behaviors.photoswipe.photoSwipeOptions;
var images = galleryElement.find('a.photoswipe');
images.each(function (index) {
var $image = $(this);
var $eleme = $image.parents("td:first");
var $eleme_class = $eleme.children('.photo_text');
var $photo_text = "";
if ( !!$eleme_class){
for ( var i = 0; i < $eleme_class.length; i++ ){
$photo_text += $eleme_class[i].innerHTML;
}
}else{
$photo_text = "";
}
// end of add
size = $image.data('size') ? $image.data('size').split('x') : ['',''];
items.push(
{
src : $image.attr('href'),
w: size[0],
h: size[1],
title : $image.data('overlay-title') + $photo_text
}
);
})
OpenPhotosweep:函数(索引、galleryElement、选项){
var pswpElement=$('.pswp')[0];
var项目=[];
选项=选项| | Drupal.behaviors.photosweep.photosweep选项;
var images=galleryElement.find('a.photosweep');
图像。每个(函数(索引){
var$image=$(这个);
var$eleme=$image.parents(“td:first”);
var$eleme_class=$eleme.children('.photo_text');
var$photo_text=“”;
如果(!!$eleme_类){
对于(变量i=0;i<$eleme\u class.length;i++){
$photo\u text+=$eleme\u class[i].innerHTML;
}
}否则{
$photo_text=“”;
}
//添加结束
size=$image.data('size')?$image.data('size')。拆分('x'):['',];
推(
{
src:$image.attr('href'),
w:大小[0],
h:尺寸[1],
标题:$image.data('overlay-title')+$photo\u text
}
);
})
我现在想知道是否有一种最简单的方法可以在不修改这个模块的情况下做同样的事情