function farm_plan_menu in farmOS 7
Implements hook_menu().
File
- modules/
farm/ farm_plan/ farm_plan.module, line 62 - Farm plan - A farm plan entity type.
Code
function farm_plan_menu() {
$items = array();
$items['farm/plan/add'] = array(
'title' => 'Add plan',
'page callback' => 'farm_plan_add_types_page',
'access callback' => 'farm_plan_add_access',
'file' => 'farm_plan.pages.inc',
);
foreach (farm_plan_types() as $type => $info) {
$items['farm/plan/add/' . $type] = array(
'title' => 'Add ' . $info->label,
'page callback' => 'farm_plan_add',
'page arguments' => array(
3,
),
'access callback' => 'farm_plan_access',
'access arguments' => array(
'create',
3,
),
'file' => 'farm_plan.pages.inc',
);
}
$farm_plan_uri = 'farm/plan/%farm_plan';
$farm_plan_uri_argument_position = 2;
$items[$farm_plan_uri] = array(
'title callback' => 'entity_label',
'title arguments' => array(
'farm_plan',
$farm_plan_uri_argument_position,
),
'page callback' => 'farm_plan_view',
'page arguments' => array(
$farm_plan_uri_argument_position,
),
'access callback' => 'farm_plan_access',
'access arguments' => array(
'view',
$farm_plan_uri_argument_position,
),
'file' => 'farm_plan.pages.inc',
);
$items[$farm_plan_uri . '/view'] = array(
'title' => 'Plan',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[$farm_plan_uri . '/delete'] = array(
'title' => 'Delete plan',
'title callback' => 'farm_plan_label',
'title arguments' => array(
$farm_plan_uri_argument_position,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'farm_plan_delete_form',
$farm_plan_uri_argument_position,
),
'access callback' => 'farm_plan_access',
'access arguments' => array(
'update',
$farm_plan_uri_argument_position,
),
'file' => 'farm_plan.pages.inc',
);
$items[$farm_plan_uri . '/edit'] = array(
'title' => 'Settings',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'farm_plan_form',
$farm_plan_uri_argument_position,
),
'access callback' => 'farm_plan_access',
'access arguments' => array(
'update',
$farm_plan_uri_argument_position,
),
'file' => 'farm_plan.pages.inc',
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
'weight' => 100,
);
// Form for removing a record from a plan.
// This is the same as the form for deleting records (below), but it will not
// delete records. It will only unlink them from the plan.
$items[$farm_plan_uri . '/%/%/remove'] = array(
'title' => 'Remove record',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'farm_plan_record_remove_form',
$farm_plan_uri_argument_position,
3,
4,
),
'access callback' => 'farm_plan_access',
'access arguments' => array(
'update',
$farm_plan_uri_argument_position,
),
'file' => 'farm_plan.pages.inc',
'type' => MENU_CALLBACK,
);
// Form for deleting a record from a plan.
// This is the same as the form for removing records (above), but it also
// gives the option to delete the record.
$items[$farm_plan_uri . '/%/%/delete'] = array(
'title' => 'Remove record',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'farm_plan_record_delete_form',
$farm_plan_uri_argument_position,
3,
4,
),
'access callback' => 'farm_plan_access',
'access arguments' => array(
'update',
$farm_plan_uri_argument_position,
),
'file' => 'farm_plan.pages.inc',
'type' => MENU_CALLBACK,
);
// Plan type delete form.
$items['admin/config/farm/plan-types/%farm_plan_type/delete'] = array(
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'farm_plan_type_form_delete_confirm',
4,
),
'access arguments' => array(
'administer farm_plan types',
),
'weight' => 1,
'type' => MENU_NORMAL_ITEM,
'file' => 'farm_plan.admin.inc',
);
return $items;
}