1 filter.pages.inc | filter_format_editor_image_form_submit($form, &$form_state) |
Submit handler for filter_format_editor_image_form().
File
- core/
modules/ filter/ filter.pages.inc, line 240 - User page callbacks for the Filter module.
Code
function filter_format_editor_image_form_submit($form, &$form_state) {
// Convert any uploaded files from the FID values to the src attribute.
if (!empty($form_state['values']['fid'])) {
$fid = $form_state['values']['fid'];
$file = file_load($fid);
// Try to make a local path if possible for better portability.
$absolute_path = parse_url($GLOBALS['base_url'], PHP_URL_PATH) . '/';
$url = file_create_url($file->uri);
$url = str_replace($GLOBALS['base_url'] . '/', $absolute_path, $url);
$form_state['values']['attributes']['src'] = $url;
$form_state['values']['attributes']['data-file-id'] = $fid;
unset($form_state['values']['fid']);
}
}