我已经修改了弹出行为js文件: openlayers_behavior_popup.js直接在模块中,位于openlayers/plugins/behaviors。
它按照我的预期很好地工作,但我不想把我自己的修改放在原来的模块中,我想把它附加到我现有的模块中,但是我不知道怎么做。
我希望网站不要采取的行为在第一层/插件/行为,但遵循我的弹出行为代码从我自己的模块。
Drupal.openlayers.addBehavior('openlayers_behavior_popup', function (data, options) {
// normal
var popupSelect = new OpenLayers.Control.SelectFeature(layers,
{
// my change here!!
},
onUnselect: function(feature) {
// normal
}
}
);
});我怎样才能改变第一层的行为代码?
发布于 2014-03-13 11:22:39
通过将修改后的javascript文件加载到我的自定义模块中,我已经解决了这个主题的问题,如下所示:
function mycustom_openlayers_init() {
// you might want to load only at some specific page
// if you want so, please have a look to function arg() of drupal
// place condition before loading the js file below
drupal_add_js ( drupal_get_path ( 'module', 'mycustom_openlayers' ) . '/js/openlayers_behavior_popup.js', array(
'weight' => '9999',
) );
}通过指定更大的权重设置,我的javascript在加载原始打开层弹出文件之后加载,然后它重写原始文件的行为,而不是我的。
我不知道这是否是正确的做法,但它对我有用。
请让我知道,如果其他人可以给我一个有规划的解决方案,并比上面更好。
https://stackoverflow.com/questions/22321889
复制相似问题