You are here

function entityform_menu in Entityform 7.2

Same name and namespace in other branches
  1. 8.3 entityform.module \entityform_menu()
  2. 8.2 entityform.module \entityform_menu()
  3. 7 entityform.module \entityform_menu()

Implements hook_menu().

File

./entityform.module, line 14
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Code

function entityform_menu() {
  $items = array();
  $entity_info = entity_get_info('entityform_type');
  $manage_path = $entity_info['admin ui']['path'] . "/manage/%entityform_type";
  $path_count = count(explode('/', $manage_path));
  $items['admin/config/content/entityform'] = array(
    'title' => 'Entityform Settings',
    'description' => '',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'entityform_settings',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'file' => 'entityform_type.admin.inc',
  );
  $items["{$manage_path}/submissions"] = array(
    'title callback' => 'entityform_type_page_title',
    'title arguments' => array(
      1,
      'submissions report',
    ),
    'page callback' => 'entityform_submission_page',
    'page arguments' => array(
      $path_count - 1,
      $path_count + 1,
      'admins',
    ),
    'access arguments' => array(
      'view any entityform',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 100,
  );

  // @todo Add another config form to set whether to show preview form.
  $items["{$manage_path}/preview"] = array(
    'title' => 'Form Preview',
    'page callback' => 'entityform_form_wrapper_preview',
    'page arguments' => array(
      $path_count - 1,
    ),
    'access arguments' => array(
      'administer entityform types',
    ),
    'file' => 'entityform.admin.inc',
    'file path' => drupal_get_path('module', 'entityform'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 110,
  );
  $items['admin/reports/entityforms/submissions/%entityform_type'] = array(
    'title callback' => 'entityform_type_page_title',
    'title arguments' => array(
      1,
      'submissions report',
    ),
    'page callback' => 'entityform_submission_page',
    'page arguments' => array(
      4,
      5,
      'admins',
    ),
    'access arguments' => array(
      'view any entityform',
    ),
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}