我正在創建一個drupal模塊,我正在使用模塊語言環境中的country_get_list()
函數。可以簡單地在模塊中添加可選的依賴關係嗎?
我想要的是提示用戶啓用語言環境模塊來改善他的體驗,但他可以拒絕。
在DOC https://drupal.org/node/542202我什麼也看不到關於可選依賴,只有需要的依賴與dependencies[] = locale
如果我的代碼,我有這樣的事情:
if(module_exists('locale')) {
$form['locale'] = array(
'#type' => 'select',
'#title' => t('Locale'),
'#options' => country_get_list(),
);
} else {
$form['locale'] = array(
'#type' => 'textfield',
'#title' => t('Locale'),
);
}
有一種簡單的方法來做到這一點與optional_dependencies[] = locale
例如在我的.info文件?