You are here

function theme_mee_resource_manager in Scald: Media Management made easy 7

Returns HTML for the MEE resource list.

Parameters

$variables: An associative array containing:

  • resource_manager: A render element representing the MEE resource list.
1 theme call to theme_mee_resource_manager()
mee_field_widget_form_alter in modules/fields/mee/mee.module
Implements hook_field_widget_form_alter().

File

modules/fields/mee/mee.module, line 607
Defines a special textarea, with drag and drop media driven by Scald and dnd.module.

Code

function theme_mee_resource_manager($variables) {
  $form = $variables['resource_manager'];
  static $count = 0;
  $id = 'mee-resource-manager-' . $count;
  drupal_add_tabledrag($id, 'order', 'sibling', 'mee-rm-weight');
  $count++;
  $header = array(
    t('Title'),
    t('Required'),
    t('Weight'),
  );
  $rows = array();
  foreach (element_children($form) as $key) {
    $form[$key]['weight']['#attributes']['class'] = array(
      'mee-rm-weight',
    );
    $row = array();
    $row[] = drupal_render($form[$key]['title']);
    $row[] = drupal_render($form[$key]['required']);
    $row[] = drupal_render($form[$key]['weight']);
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => $id,
      'class' => array(
        'mee-resource-manager',
      ),
    ),
    'caption' => t('Resource Manager'),
  ));
  $output .= drupal_render_children($form);
  return $output;
}