You are here

function media_admin_display_switch in D7 Media 7

Build the display switch portion of the file listings form.

1 call to media_admin_display_switch()
media_admin in includes/media.admin.inc
Display the list or thumbnails media admin display.

File

includes/media.admin.inc, line 218
This file contains the admin functions for the Media module.

Code

function media_admin_display_switch($options = array()) {
  $options += array(
    'form location' => 'admin/content/media',
    'active display' => 'list',
  );
  $display_types = media_display_types();

  // Build the item list.
  $display_items = array();
  foreach ($display_types as $delta => $item) {
    $attributes = array(
      'title' => $item['description'],
    );

    // Set a seperate icon for the active item.
    if ($delta == $options['active display']) {
      $icon = $item['icon_active'];
      $attributes['class'][] = 'active';
    }
    else {
      $icon = $item['icon'];
    }
    $display_items[] = array(
      'data' => l(theme('image', array(
        'path' => $icon,
        'alt' => $item['title'],
      )), $options['form location'] . '/' . $delta, array(
        'html' => TRUE,
        'attributes' => $attributes,
      )),
    );
  }
  return array(
    '#type' => 'markup',
    '#markup' => theme('item_list', array(
      'items' => $display_items,
      'attributes' => array(
        'class' => 'media-display-switch',
      ),
    )),
  );
}