function _ueditor_get_editor_fields in UEditor - 百度编辑器 7.3
Same name and namespace in other branches
- 7.2 ueditor.module \_ueditor_get_editor_fields()
ueditor match fields with use ueditor.
3 calls to _ueditor_get_editor_fields()
- ueditor_entity_presave in ./
ueditor.module - Implements hook_entity_presave().
- ueditor_entity_view in ./
ueditor.module - Implements hook_entity_view().
- ueditor_form_alter in ./
ueditor.module - Implementation of hook_form_alter().
File
- ./
ueditor.module, line 712 - Integration ueditor for wysiwyg.
Code
function _ueditor_get_editor_fields($entity, $type, $editor_profiles) {
if (!empty($editor_profiles)) {
$fields = array();
// Loop through the fields looking for any fields of use ueditor.
foreach (field_info_field_map() as $field_name => $field_stub) {
if ($field_stub['type'] == 'text_long' || $field_stub['type'] == 'text_with_summary') {
if (isset($entity->{$field_name})) {
$fields[$field_name] = $field_name;
}
}
}
foreach ($fields as $index => $field) {
$language = field_language($type, $entity, $field);
$field_items = field_get_items($type, $entity, $field, $language);
if (!empty($field_items[0]['format']) && in_array($field_items[0]['format'], $editor_profiles)) {
$fields[$field] = $field_items;
}
}
return $fields;
}
return FALSE;
}