You are here

function log_menu in Log entity 7

Implements hook_menu().

File

./log.module, line 59
Log - A general purpose record keeping system.

Code

function log_menu() {
  $items = array();
  $items['log/add'] = array(
    'title' => 'Add log',
    'page callback' => 'log_add_types_page',
    'access callback' => 'log_add_access',
    'file' => 'log.pages.inc',
  );
  foreach (log_types() as $type => $info) {
    $items['log/add/' . $type] = array(
      'title' => 'Add log',
      'page callback' => 'log_add',
      'page arguments' => array(
        2,
      ),
      'access callback' => 'log_access',
      'access arguments' => array(
        'create',
        2,
      ),
      'file' => 'log.pages.inc',
    );
  }
  $log_uri = 'log/%log';
  $log_uri_argument_position = 1;
  $items[$log_uri] = array(
    'title callback' => 'entity_label',
    'title arguments' => array(
      'log',
      $log_uri_argument_position,
    ),
    'page callback' => 'log_view',
    'page arguments' => array(
      $log_uri_argument_position,
    ),
    'access callback' => 'log_access',
    'access arguments' => array(
      'view',
      $log_uri_argument_position,
    ),
    'file' => 'log.pages.inc',
  );
  $items[$log_uri . '/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items[$log_uri . '/delete'] = array(
    'title' => 'Delete log',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'log_delete_form',
      $log_uri_argument_position,
    ),
    'access callback' => 'log_access',
    'access arguments' => array(
      'update',
      $log_uri_argument_position,
    ),
    'file' => 'log.pages.inc',
  );
  $items[$log_uri . '/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'log_form',
      $log_uri_argument_position,
    ),
    'access callback' => 'log_access',
    'access arguments' => array(
      'update',
      $log_uri_argument_position,
    ),
    'file' => 'log.pages.inc',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );

  // Log settings form.
  $items['admin/config/log'] = array(
    'title' => 'Log',
    'description' => 'Configure log module.',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'administer log module',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/config/log/settings'] = array(
    'title' => 'Log settings',
    'description' => 'Administer log settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'log_settings_form',
      4,
    ),
    'access arguments' => array(
      'administer log module',
    ),
    'file' => 'log.admin.inc',
  );

  // Log type delete form.
  $items['admin/config/log/types/%log_type/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'log_type_form_delete_confirm',
      4,
    ),
    'access arguments' => array(
      'administer log types',
    ),
    'weight' => 1,
    'type' => MENU_NORMAL_ITEM,
    'file' => 'log.admin.inc',
  );

  // Log name autocomplete callback.
  $items['log/autocomplete/%'] = array(
    'title' => 'Autocomplete for log names',
    'page callback' => 'log_name_autocomplete',
    'page arguments' => array(
      2,
      3,
    ),
    'access callback' => 'log_name_autocomplete_access',
    'access arguments' => array(
      2,
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}