function wysiwyg_get_all_editors in Wysiwyg 6
Same name and namespace in other branches
- 5.2 wysiwyg.module \wysiwyg_get_all_editors()
- 5 wysiwyg.module \wysiwyg_get_all_editors()
- 6.2 wysiwyg.module \wysiwyg_get_all_editors()
- 7.2 wysiwyg.module \wysiwyg_get_all_editors()
Compile a list holding all supported editors including installed editor version information.
Related topics
2 calls to wysiwyg_get_all_editors()
- wysiwyg_get_editor in ./
wysiwyg.module - Return library information for a given editor.
- wysiwyg_profile_overview in ./
wysiwyg.admin.inc - Display overview of setup Wysiwyg Editor profiles; menu callback.
File
- ./
wysiwyg.module, line 569 - Integrate client-side editors with Drupal.
Code
function wysiwyg_get_all_editors() {
static $editors;
if (isset($editors)) {
return $editors;
}
$editors = wysiwyg_load_includes('editors', 'editor');
foreach ($editors as $editor => $properties) {
// Fill in required properties.
$editors[$editor] += array(
'title' => '',
'vendor url' => '',
'download url' => '',
'editor path' => wysiwyg_get_path($properties['name']),
'library path' => wysiwyg_get_path($properties['name']),
'libraries' => array(),
'version callback' => NULL,
'themes callback' => NULL,
'settings callback' => NULL,
'plugin callback' => NULL,
'plugin settings callback' => NULL,
'versions' => array(),
'js path' => $properties['path'] . '/js',
'css path' => $properties['path'] . '/css',
);
// Check whether library is present.
if (!($editors[$editor]['installed'] = file_exists($properties['library path']))) {
continue;
}
// Detect library version.
if (function_exists($editors[$editor]['version callback'])) {
$editors[$editor]['installed version'] = $editors[$editor]['version callback']($properties);
}
if (empty($editors[$editor]['installed version'])) {
$editors[$editor]['error'] = t('The version of %editor could not be detected.', array(
'%editor' => $properties['title'],
));
$editors[$editor]['installed'] = FALSE;
continue;
}
// Determine to which supported version the installed version maps.
ksort($editors[$editor]['versions']);
$version = 0;
foreach ($editors[$editor]['versions'] as $supported_version => $version_properties) {
if (version_compare($editors[$editor]['installed version'], $supported_version, '>=')) {
$version = $supported_version;
}
}
if (!$version) {
$editors[$editor]['error'] = t('The installed version %version of %editor is not supported.', array(
'%version' => $editors[$editor]['installed version'],
'%editor' => $properties['title'],
));
$editors[$editor]['installed'] = FALSE;
continue;
}
// Apply library version specific definitions and overrides.
$editors[$editor] = array_merge($editors[$editor], $editors[$editor]['versions'][$version]);
unset($editors[$editor]['versions']);
}
return $editors;
}