You are here

function data_ui_menu in Data 7

Same name and namespace in other branches
  1. 6 data_ui/data_ui.module \data_ui_menu()

Implements hook_menu().

File

data_ui/data_ui.module, line 38
Hooks and API functions for Data UI module.

Code

function data_ui_menu() {
  $items = array();
  if (module_exists('views')) {
    $items['admin/content/data'] = array(
      'title' => 'Data tables',
      'description' => 'View data tables.',
      'page callback' => 'data_ui_view',
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
    );
  }
  $items['admin/structure/data'] = array(
    'title' => 'Data tables',
    'description' => 'Create, modify and delete data tables.',
    'page callback' => 'data_ui_manage',
    'file' => 'data_ui.admin.inc',
    'access arguments' => array(
      'administer data tables',
    ),
  );
  $items['admin/structure/data/overview'] = array(
    'title' => 'Overview',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/structure/data/compare'] = array(
    'title' => 'Compare schemas',
    'description' => 'Administer data tables.',
    'page callback' => 'data_ui_compare',
    'file' => 'data_ui.admin.inc',
    'access arguments' => array(
      'administer data tables',
    ),
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/structure/data/adopt'] = array(
    'title' => 'Adopt tables',
    'description' => 'Adopt data tables that aren\'t claimed by any module.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'data_ui_adopt_form',
    ),
    'file' => 'data_ui.admin.inc',
    'access arguments' => array(
      'administer data tables',
    ),
    'type' => MENU_LOCAL_ACTION,
    'weight' => 10,
  );
  $items['admin/structure/data/create'] = array(
    'title' => 'Create new table',
    'description' => 'Create a data table.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'data_ui_create_form',
    ),
    'file' => 'data_ui.admin.inc',
    'access arguments' => array(
      'administer data tables',
    ),
    'type' => MENU_LOCAL_ACTION,
  );

  // Menu items in the tab set that data_entity adds Field UI tabs to need to
  // have separate router items per table (and thus per entity type).
  $tables = data_get_all_tables();
  foreach ($tables as $table_name => $table) {
    $items['admin/structure/data/compare/' . $table_name . ''] = array(
      'title' => 'Adjust schema',
      'description' => 'Administer data tables.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_ui_adjust_form',
        4,
      ),
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_LOCAL_TASK,
    );
    $items['admin/structure/data/drop/' . $table_name . ''] = array(
      'title' => 'Drop table',
      'description' => 'Drop a data table.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_ui_drop_form',
        4,
      ),
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_CALLBACK,
    );
    $items['admin/structure/data/disown/' . $table_name . ''] = array(
      'title' => 'Disown table',
      'description' => 'Disown a data table.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_ui_disown_form',
        4,
      ),
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_CALLBACK,
    );
    $items['admin/structure/data/edit/' . $table_name . ''] = array(
      'title' => 'Data table',
      'description' => 'Administer data tables.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_ui_edit_form',
        4,
      ),
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_NORMAL_ITEM,
    );
    $items['admin/structure/data/edit/' . $table_name . '/edit'] = array(
      'title' => 'Edit schema',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items['admin/structure/data/edit/' . $table_name . '/title'] = array(
      'title' => 'Edit title',
      'description' => 'Edit the title of the table.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_ui_edit_title_form',
        4,
      ),
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => -9,
    );
    if (module_exists('views')) {
      $items['admin/structure/data/edit/' . $table_name . '/views'] = array(
        'title' => 'Configure views',
        'description' => 'Administer data tables.',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'data_ui_views_form',
          4,
        ),
        'file' => 'data_ui.admin.inc',
        'access arguments' => array(
          'administer data tables',
        ),
        'type' => MENU_LOCAL_TASK,
        'weight' => -5,
      );
    }
    if (module_exists('date_views')) {
      $items['admin/structure/data/edit/' . $table_name . '/date'] = array(
        'title' => 'Configure date fields',
        'description' => 'Administer data tables.',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'data_ui_date_form',
          4,
        ),
        'file' => 'data_ui.admin.inc',
        'access arguments' => array(
          'administer data tables',
        ),
        'type' => MENU_LOCAL_TASK,
        'weight' => -4,
      );
    }
    if (module_exists('devel')) {
      $items['admin/structure/data/edit/' . $table_name . '/view-schema'] = array(
        'title' => 'Devel load',
        'description' => 'Administer data tables.',
        'page callback' => 'data_ui_view_schema',
        'page arguments' => array(
          4,
        ),
        'file' => 'data_ui.admin.inc',
        'access arguments' => array(
          'administer data tables',
        ),
        'type' => MENU_LOCAL_TASK,
        'weight' => 10,
      );
    }
    $items['admin/structure/data/edit/' . $table_name . '/join'] = array(
      'title' => 'Join tables',
      'description' => 'Administer data tables.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_ui_join_form',
        4,
        6,
      ),
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_CALLBACK,
    );
    $items['admin/structure/data/revert/' . $table_name . ''] = array(
      'title' => 'Revert data table',
      'description' => 'Administer data tables.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_ui_revert_form',
        4,
      ),
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_CALLBACK,
    );
    $items['admin/structure/data/export/' . $table_name . ''] = array(
      'title' => 'Data table',
      'description' => 'Export data table.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_ui_export_form',
        4,
      ),
      'file' => 'data_ui.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}