You are here

function assets_wysiwyg_form in Asset 7

Page callback for wysiwyg form.

@todo: We need to redo both edit and override form to avoid complex form building and duplication for drupal_alter().

1 string reference to 'assets_wysiwyg_form'
asset_menu in ./asset.module
Implements hook_menu().

File

includes/asset.admin.inc, line 332
Asset admin page callbacks.

Code

function assets_wysiwyg_form($form, &$form_state, $op, $asset, $mode = ASSET_DEFAULT_MODE, $align = '') {

  // In case of add operation we have only type name, but on edit we will have whole entity.
  if ($op == 'add') {
    $asset = new Asset(array(
      'type' => $asset,
    ));
  }
  $form_state['entity_type'] = 'asset';
  $form_state['op'] = $op;
  $form_state['asset'] = $asset;
  $form_state['build_info']['base_form_id'] = 'asset_base_form';
  $form = asset_base_form($form, $form_state, $asset, $op);
  $hooks = array(
    'form',
  );
  $hooks[] = 'form_' . $form_state['build_info']['base_form_id'];
  $hooks[] = 'form_asset_edit_' . $form['#bundle'] . '_form';
  $form_id = 'asset_edit_' . $form['#bundle'] . '_form';
  drupal_alter($hooks, $form, $form_state, $form_id);
  $form['#submit'][] = 'asset_base_form_submit';
  $form['#submit'][] = 'assets_wysiwyg_form_submit';
  _assets_in_editor_form_add_default_fields($form, $asset, array(
    'mode' => $mode,
    'align' => $align,
  ));
  unset($form['actions']['delete']);
  return $form;
}