You are here

function data_entity_menu in Data 7

Implements hook_menu().

File

data_entity/data_entity.module, line 103
data_entity.module TODO: Enter file description here.

Code

function data_entity_menu() {
  $tables = data_get_all_tables();
  foreach ($tables as $table_name => $table) {

    // Items that are in the same tab set as Field UI tabs need to have separate
    // menu router items.
    $items['admin/structure/data/edit/' . $table_name . '/entity-type'] = array(
      'title' => 'Entity type',
      'description' => 'Configure the entity type for the data table.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_entity_admin_entity_type_form',
        4,
      ),
      'file' => 'data_entity.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => -3,
    );

    // The following menu items only concern tables that are declared as
    // entity types, so skip those that are not.
    $meta = $table
      ->get('meta');
    if (empty($meta['is_entity_type'])) {
      continue;
    }
    $items['admin/structure/data/edit/' . $table_name . '/entity-form'] = array(
      'title' => 'Configure entity form',
      'description' => 'Administer data tables.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'data_entity_admin_entity_form',
        4,
      ),
      'file' => 'data_entity.admin.inc',
      'access arguments' => array(
        'administer data tables',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => -2,
    );
  }
  $items['admin/content/data/entity/%data_ui_table/%data_entity_item'] = array(
    'title' => 'Edit data item',
    'load arguments' => array(
      4,
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'data_entity_entity_edit_form',
      4,
      5,
    ),
    'file' => 'data_entity.pages.inc',
    'access callback' => 'data_entity_table_menu_access',
    'access arguments' => array(
      4,
    ),
  );
  return $items;
}