function ueditor_entity_view in UEditor - 百度编辑器 7.2
Same name and namespace in other branches
- 7.3 ueditor.module \ueditor_entity_view()
Implements hook_entity_view().
File
- ./
ueditor.module, line 790 - Integration ueditor for wysiwyg.
Code
function ueditor_entity_view($entity, $type, $view_mode, $langcode) {
if ($view_mode == 'full') {
$editor_profiles = _ueditor_get_wysiwyg();
$fields = _ueditor_get_editor_fields($entity, $type, $editor_profiles);
//add support taxonomy term description field.
if ($type == 'taxonomy_term' && isset($entity->description)) {
$fields['description'][]['value'] = $entity->description;
}
if (variable_get('ueditor_enable_colorbox') == 1 && module_exists('colorbox')) {
$colorbox_type = variable_get('colorbox_load', 0);
if ($colorbox_type) {
$settings = array(
'width' => variable_get('ueditor_colorbox_width', 500),
'height' => variable_get('ueditor_colorbox_height', 500),
);
if ($fields) {
foreach ($fields as $key => $field) {
if (!empty($field[0]['value'])) {
$entity->content[$key][0]['#markup'] = ueditor_add_colorbox($entity->content[$key][0]['#markup'], $settings);
}
}
}
}
else {
drupal_set_message(t('Plese ensure you enable the !link settings.', array(
'!link' => l(t('Colorbox Load'), 'admin/config/media/colorbox'),
)), 'error');
}
}
}
}