function ueditor_entity_insert in UEditor - 百度编辑器 7.2
Implements hook_entity_insert().
File
- ./
ueditor.module, line 731 - Integration ueditor for wysiwyg.
Code
function ueditor_entity_insert($entity, $type) {
if ($type != 'file') {
$info = entity_get_info($type);
list($id) = entity_extract_ids($type, $entity);
if (!empty($id)) {
$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 ($fields) {
foreach ($fields as $field_key => $field) {
if (!empty($field[0]['value'])) {
preg_match_all('/(.*?(src|href)=["|\'])(.*?)["|\']/ms', $field[0]['value'], $matchs[$field_key]);
if (isset($matchs[$field_key][3])) {
ueditor_file_register($matchs[$field_key][3], $type, $field_key, $id);
}
}
}
}
}
}
}