You are here

function media_form_file_entity_edit_alter in D7 Media 7.2

Same name and namespace in other branches
  1. 7.4 media.module \media_form_file_entity_edit_alter()
  2. 7.3 media.module \media_form_file_entity_edit_alter()

Implements hook_form_FORM_ID_alter().

File

./media.module, line 875
Media API

Code

function media_form_file_entity_edit_alter(&$form, &$form_state) {

  // Make adjustments to the file edit form when used in a CTools modal.
  if (!empty($form_state['ajax'])) {

    // Remove the preview and the delete button.
    $form['preview']['#access'] = FALSE;
    $form['actions']['delete']['#access'] = FALSE;

    // Convert the cancel link to a button which triggers a modal close.
    $form['actions']['cancel']['#attributes']['class'][] = 'button';
    $form['actions']['cancel']['#attributes']['class'][] = 'button-no';
    $form['actions']['cancel']['#attributes']['class'][] = 'ctools-close-modal';
  }
}