You are here

function relation_ui_admin_content in Relation 7

Menu callback for admin/content/relation. Displays all relations on the site.

1 string reference to 'relation_ui_admin_content'
relation_ui_menu in ./relation_ui.module
Implements hook_menu().

File

./relation_ui.module, line 593
Provide administration interface for relation type bundles.

Code

function relation_ui_admin_content() {

  // Set up header row.
  $header = array(
    'label' => array(
      'data' => t('Title'),
      'field' => 'r.rid',
      'sort' => 'asc',
    ),
    'type' => array(
      'data' => t('Type'),
      'field' => 'r.relation_type',
    ),
    t('Relation'),
    'operations' => array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );

  // Grab all relations.
  $query = db_select('relation', 'r')
    ->extend('PagerDefault')
    ->extend('TableSort');
  $query
    ->fields('r', array(
    'rid',
    'relation_type',
  ));
  relation_ui_build_filter_query($query);
  $query
    ->limit(50)
    ->orderByHeader($header);
  $relations = $query
    ->execute();
  $form = drupal_get_form('relation_ui_filter_form');
  $filter_form = drupal_render($form);
  return $filter_form . theme('relation_ui_admin_content', array(
    'relations' => $relations,
    'header' => $header,
  ));
}