我一直在寻找几天来弄清楚如何在 Drupal-7 中更改 swiper (v 7.x-1.4) 模块的选项。文档清楚地解释了模块期望如何使用这个钩子。我正在寻找一个关于如何从 swiper API 实现以下选项的简单代码示例:
autoplay
prevButton
nextButton
autoplayDisableOnInteraction
我能找到的唯一文档参考来自模块中的 README.txt:
...
You can also add, change and remove, any of API options of the Swipers,
just you need to implement a hook:
hook_swiper_options_alter($node, $plugin_options) {}
This way the module will handle pass these options to the script that
instantiates the swiper Plugin.
...
我对 Drupal 还很陌生,但我正在努力学习。我试图创建一个简单的自定义模块来实现这些选项。我调用了我的模块 myCustom,创建了 /drupal/sites/all/modules/myCustom 目录,其中包含以下文件:
myCustom.info:
name = myCustom
description = customize swiper
package = me
version = 0.02
core = 7.x
files[] = myCustom.module
myCustom.module:
<?php
function myCustom_swiper_options_alter($node, $plugin_options)
{
$plugin_options += (
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
paginationClickable: true,
autoplay: 2500,
autoplayDisableOnInteraction: true
);
return($node, $plugin_options);
}
我知道我有多个问题。Drupal 拒绝按原样启用我的模块,我不知道为什么。我检查了 admin->reports->recent log messages 报告,发现没有任何相关的东西至少可以帮助我进行故障排除。
有什么想法可以解决这个问题吗?有没有人有我可以复制和修改以使这个钩子工作的代码的工作示例?
提前感谢您的任何帮助!