function paragraphs_table_menu in Paragraphs table 7
Implements hook_menu().
File
- ./
paragraphs_table.module, line 530 - Module file for Paragraph table module.
Code
function paragraphs_table_menu() {
$items = array();
// Add menu paths for viewing/editing/deleting/duplicate paragraphs items.
foreach (field_info_fields() as $field) {
if ($field['type'] == 'paragraphs') {
$path = paragraphs_field_get_path($field);
$count = count(explode('/', $path));
$items[$path . '/%pharagraphs_item'] = array(
'page callback' => 'pharagraphs_item_page_view',
'page arguments' => array(
$count,
),
'access callback' => 'entity_access',
'access arguments' => array(
'view',
'pharagraphs',
$count,
),
'file' => 'pharagraphs_table.pages.inc',
);
$items[$path . '/%pharagraphs_item/view'] = array(
'title' => 'View',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[$path . '/%pharagraphs_item/edit'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'pharagraphs_item_form',
$count,
),
'access callback' => 'entity_access',
'access arguments' => array(
'update',
'pharagraphs_item',
$count,
),
'title' => 'Edit',
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
'file' => 'pharagraphs_table.pages.inc',
);
$items[$path . '/%pharagraphs_item/duplicate'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'pharagraphs_item_add',
$count,
),
'access callback' => 'entity_access',
'access arguments' => array(
'update',
'pharagraphs_item',
$count,
),
'title' => 'Edit',
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
'file' => 'pharagraphs_table.pages.inc',
);
$items[$path . '/%pharagraphs_item/delete'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'pharagraphs_item_delete_confirm',
$count,
),
'access callback' => 'entity_access',
'access arguments' => array(
'delete',
'pharagraphs_item',
$count,
),
'title' => 'Delete',
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_INLINE,
'file' => 'pharagraphs_table.pages.inc',
);
// Add entity type and the entity id as additional arguments.
$items[$path . '/add/%/%'] = array(
'page callback' => 'pharagraphs_item_add',
'page arguments' => array(
$field['field_name'],
$count + 1,
$count + 2,
),
// The pace callback takes care of checking access itself.
'access callback' => TRUE,
'file' => 'pharagraphs_table.pages.inc',
);
// Add menu items for dealing with revisions.
$items[$path . '/%pharagraphs_item/revisions/%pharagraphs_item_revision'] = array(
'page callback' => 'pharagraphs_item_page_view',
'page arguments' => array(
$count + 2,
),
'access callback' => 'entity_access',
'access arguments' => array(
'view',
'pharagraphs_item',
$count + 2,
),
'file' => 'pharagraphs_table.pages.inc',
);
}
}
return $items;
}