function assets_override_form_submit in Asset 7
Custom submit handler.
1 string reference to 'assets_override_form_submit'
- assets_override_form in includes/
asset.admin.inc - Page callback for asset override form in wysiwyg.
File
- includes/
asset.admin.inc, line 506 - Asset admin page callbacks.
Code
function assets_override_form_submit(&$form, &$form_state) {
$values = $form_state['values'];
$original_asset = clone asset_load($form['#entity']->aid, TRUE);
$view_mode = isset($values['view_mode']) ? $values['view_mode'] : ASSET_DEFAULT_MODE;
$alignment = isset($values['align']) ? $values['align'] : '';
$asset = entity_ui_form_submit_build_entity($form, $form_state);
$placeholder = assets_build_placeholder($asset, array(
'mode' => $view_mode,
'align' => $alignment,
), $original_asset);
$placeholder = addslashes($placeholder);
$placeholder = str_replace("\r\n", '\\n', $placeholder);
$js = 'var CKEDITOR = parent.CKEDITOR;
var dialog = CKEDITOR.dialog.getCurrent();
var outdated = dialog._outdatedAssetEl;
if (outdated) {
var tag_id = outdated.data(\'asset-cid\');
dialog._.editor.plugins.asset.replaceAsset(tag_id, \'' . $placeholder . '\' );
}
dialog.hide();';
echo '<script>' . $js . '</script>';
drupal_exit();
}