You are here

function media_browser_plus_folder_list in Media Browser Plus 7

Same name and namespace in other branches
  1. 7.2 includes/media_browser_plus.folders.inc \media_browser_plus_folder_list()

@todo Document what this function does.

_state

Parameters

$form:

1 string reference to 'media_browser_plus_folder_list'
media_browser_plus_menu in ./media_browser_plus.module
Implements hook_menu().

File

includes/media_browser_plus.folders.inc, line 13
Folder manipulation functions

Code

function media_browser_plus_folder_list($form, &$form_state) {
  $destination = drupal_get_destination();
  $form['action-links'] = array(
    '#type' => 'markup',
    '#markup' => '<ul class="action-links"><li>' . l(t('Add new folder'), 'admin/content/media/add_folder', array(
      'query' => $destination,
    )) . '</li></ul>',
  );
  $header = array(
    'name' => array(
      'data' => t('Name'),
      'width' => '55%',
    ),
    'weight' => array(
      'data' => t('Weight'),
      'width' => '15%',
    ),
    'description' => array(
      'data' => t('Description'),
      'width' => '30%',
    ),
    'operations' => array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  drupal_add_tabledrag('folder-overview', 'match', 'parent', 'folder-pid', 'folder-pid', 'folder-folder_id', TRUE);
  drupal_add_tabledrag('folder-overview', 'order', 'sibling', 'folder-weight');

  // Get table rows.
  $rows = media_browser_plus_folder_admin_list();
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No folders created yet.'),
        'colspan' => '5',
      ),
    );
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'folder-overview',
    ),
  ));
  $form['admin'] = array(
    '#type' => 'markup',
    '#markup' => $output,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Changes'),
  );
  $form['actions']['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#submit' => array(
      'media_browser_plus_folder_admin_list_cancel',
    ),
  );
  return $form;
}