0
当前我使用this answer中建议的代码。这是以下几点:将类添加到Drupal 7中特定内容类型的图像字段中
function simalr_preprocess_image(&$variables) {
if ($variables['style_name'] == 'request-background') {
$variables['attributes']['class'][] = 'pixastic';
$variables['attributes']['class'][] = 'pixastic-blurfast(amount=1)';
}
}
这工作得很好,除了事实上,我得到它不以“请求后台”风格的图片页面上出现以下错误信息:
注意:simalr_preprocess_image()中的未定义索引:style_name(/var/www/vhosts/simalr.com/httpdocs/sites/all/themes/simalr/template.php第46行)。
我只想在特定内容类型(即'请求')上使用这段代码。在哪种方式下,我必须调整我的template.php文件中的代码,以便在只有特定内容类型的页面上使用它?
谢谢,但我已经试过这个,但我仍然收到错误。你可能会重写我的代码给我一个更好的例子吗? – rroose 2012-07-11 17:43:05