function _linkit_add_settings in Linkit 7.2
Same name and namespace in other branches
- 6 linkit.module \_linkit_add_settings()
- 7 linkit.module \_linkit_add_settings()
Add necessary settings to the Drupal.settings array and include the libraries we need.
3 calls to _linkit_add_settings()
- linkit_pre_render_ckeditor_element in ./
linkit.module - Add Linkit settings to pages where we have a ckeditor element.
- linkit_process_widget in ./
linkit.field.inc - Process callback.
- linkit_wysiwyg_plugin in ./
linkit.module - Implements hook_wysiwyg_plugin().
File
- ./
linkit.module, line 588 - Main file for linkit module.
Code
function _linkit_add_settings($editor) {
static $globalsettings, $set_urls;
drupal_add_library('linkit', 'linkit_base');
$profile = linkit_get_dashboard_profile();
if (!$globalsettings && $profile) {
// Check if IMCE is enbled and accessable
if (module_invoke('imce', 'access') && isset($profile->data['imce']['use_imce']) && $profile->data['imce']['use_imce'] == 1) {
$settings['IMCEurl'] = url('imce', array(
'query' => array(
'app' => 'Linkit|sendto@Drupal.linkit.dialog.IMCECallback',
'absolute' => TRUE,
),
));
// We will only serv public files with IMCE.
$settings['publicFilesDirectory'] = variable_get('file_public_path', conf_path() . '/files');
}
$settings['autocomplete'] = array_filter($profile->data['autocomplete']);
// Add caseSensitive
$settings['autocomplete'] += array(
'caseSensitive' => TRUE,
);
drupal_add_js(array(
'linkit' => $settings,
), 'setting');
$globalsettings = TRUE;
}
if (!isset($set_urls[$editor])) {
// Add dialog url for the editor.
$settings = array(
'linkit' => array(
'url' => array(
$editor => url('linkit/dashboard/' . $editor),
),
),
);
drupal_add_js($settings, 'setting');
$set_urls[$editor] = TRUE;
}
// Add the linkit library for the editor.
drupal_add_library('linkit', 'linkit_' . $editor);
}