function editor_display_toolbars in Editor 5
Same name and namespace in other branches
- 6 editor.module \editor_display_toolbars()
Generate toolbar markup.
- Plugins required for display within the $profile passed are gathered.
- Spacer characters; '|' are replaced with theme_editor_spacer().
- Plugins are validated for dependencies.
- hook_plugin_api('alter') is invoked.
- Plugin themes are applied.
Parameters
object $profile: Plugin profile object
Return value
string Markup.
See also
1 call to editor_display_toolbars()
- editor_attach in ./
editor.module - Initialize the editor attachment process.
File
- ./
editor.module, line 213 - Extendable WYSIWYG editor @author Tj Holowaychuk <tj@vision-media.ca> @link http://vision-media.ca @package Editor
Code
function editor_display_toolbars($profile) {
$items = array();
$plugins = editor_profile_plugins($profile);
$plugin_count = count($plugins);
if (count($plugins)) {
foreach ($plugins as $i => $plugin) {
// Ignore processing hidden plugins
if ($plugin->class == 'hidden') {
continue;
}
// Check for spacers
if ($plugin == '|') {
// No need for spacers at the beginning or end or the toolbars
if ($i != 0 && $i != $plugin_count - 1) {
$items[] = theme('editor_spacer');
}
continue;
}
// Invoke alter op
editor_invoke_plugin_api('alter', $plugin);
$plugin_class = editor_plugin_class_get($plugin->class);
// Class must be available
if ($plugin && $plugin_class) {
// Theme must be available
$theme = 'theme_' . $plugin_class->theme;
if (function_exists($theme)) {
$args = array();
$args[] = $plugin_class->theme;
$args[] = $plugin;
if (count($plugin->theme_args)) {
foreach ($plugin->theme_args as $arg) {
$args[] = $arg;
}
}
$items[] = @call_user_func_array('theme', $args);
}
}
}
}
return theme('editor_toolbar', implode(' ', $items));
}