function ueditor_entity_delete in UEditor - 百度编辑器 7.2
Implements hook_entity_delete().
File
- ./
ueditor.module, line 762 - Integration ueditor for wysiwyg.
Code
function ueditor_entity_delete($entity, $type) {
$info = entity_get_info($type);
list($id) = entity_extract_ids($type, $entity);
$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);
if (isset($matchs[3])) {
if ($entity->nid) {
ueditor_delete_file($matchs[3], $type, $field_key, $id);
}
}
}
}
}
}