You are here

function view_modes_display_menu in View Modes Display 7

Implements hook_menu().

File

./view_modes_display.module, line 6

Code

function view_modes_display_menu() {
  $items = array();
  $items['node/%node/preview'] = array(
    'title' => 'Preview display',
    'description' => 'Preview display of this content in the enabled view modes.',
    'page callback' => 'view_modes_display_preview_entity',
    'page arguments' => array(
      1,
      'node',
    ),
    'file' => 'view_modes_display.pages.inc',
    'access arguments' => array(
      'preview view modes',
    ),
    'type' => MENU_LOCAL_TASK,
  );
  $items['user/%user/preview'] = array(
    'title' => 'Preview display',
    'description' => 'Preview display of this user profile.',
    'page callback' => 'view_modes_display_preview_entity',
    'page arguments' => array(
      1,
      'user',
    ),
    'file' => 'view_modes_display.pages.inc',
    'access arguments' => array(
      'preview view modes',
    ),
    'type' => MENU_LOCAL_TASK,
  );
  if (module_exists('taxonomy')) {
    $items['taxonomy/term/%taxonomy_term/preview'] = array(
      'title' => 'Preview display',
      'description' => 'Preview display of this term.',
      'page callback' => 'view_modes_display_preview_entity',
      'page arguments' => array(
        2,
        'taxonomy_term',
      ),
      'access arguments' => array(
        'preview view modes',
      ),
      'file' => 'view_modes_display.pages.inc',
      'type' => MENU_LOCAL_TASK,
      'weight' => 12,
    );
  }
  if (module_exists('profile2_page')) {
    foreach (profile2_get_types() as $type_name => $type) {
      if (!empty($type->data['use_page'])) {
        $path = profile2_page_get_base_path($type);
        $count = count(explode('/', $path));
        $items[$path . '/%profile2_by_uid/preview'] = array(
          'title' => 'Preview display',
          'description' => 'Preview display of this profile2.',
          'page callback' => 'view_modes_display_preview_entity',
          'page arguments' => array(
            $count,
            'profile2',
          ),
          'access callback' => 'profile2_access',
          'access arguments' => array(
            'edit',
            $count,
          ),
          'file' => 'view_modes_display.pages.inc',
          'type' => MENU_LOCAL_TASK,
          'weight' => 12,
        );
      }
    }
  }
  return $items;
}