You are here

function media_form_alter in D7 Media 8

Same name and namespace in other branches
  1. 6 media.module \media_form_alter()
  2. 7.4 media.module \media_form_alter()
  3. 7.2 media.module \media_form_alter()
  4. 7.3 media.module \media_form_alter()

Implements hook_form_alter().

File

./media.module, line 31
Contains media.module.

Code

function media_form_alter(&$form, FormStateInterface &$form_state) {
  if ($form['#form_id'] == 'entity_browser_media_library_form') {

    // Style the submit button.
    $form['actions']['submit']['#attributes']['class'][] = 'button--primary';
    $form['actions']['submit']['#attributes']['class'][] = 'entity-browser-modal-target';
  }

  // Remove the Gallery option from create gallery view's bundle filters.
  if ($form['#id'] == 'views-exposed-form-media-library-gallery-media-select-modal' || $form['#id'] == 'views-exposed-form-media-library-gallery-user-media-select-modal') {
    unset($form['bundle_1']['#options']['gallery']);
  }
  if ($form['#form_id'] == 'media_gallery_form') {
    $form['#attached']['library'][] = 'media/view';
  }
}