You are here

function _nd_menu in Node displays 6

Return menu items.

1 call to _nd_menu()
nd_menu in ./nd.module
Implementation of hook_menu().

File

includes/nd.registry.inc, line 11
Registry functions.

Code

function _nd_menu() {
  $items = array();
  $build_modes = nd_get_build_modes(NULL, TRUE);
  if (!empty($build_modes)) {
    foreach (node_get_types() as $type) {
      $type_name = $type->type;
      $type_url_str = str_replace('_', '-', $type_name);
      $items['admin/content/node-type/' . $type_url_str . '/display'] = array(
        'title' => 'Display fields',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'nd_display_overview_form',
          $type_name,
        ),
        'access arguments' => array(
          'administer content types',
        ),
        'file' => 'includes/nd.display.inc',
        'type' => MENU_LOCAL_TASK,
        'weight' => 2,
      );

      // Add build modes from nd.
      $weight = 20;
      foreach ($build_modes as $key => $value) {
        $items['admin/content/node-type/' . $type_url_str . '/display/' . $key] = array(
          'title' => $value['title'],
          'page callback' => 'drupal_get_form',
          'page arguments' => array(
            'nd_display_overview_form',
            $type_name,
            "{$key}",
          ),
          'access arguments' => array(
            'administer content types',
          ),
          'type' => $key == 'full' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
          'file' => 'includes/nd.display.inc',
          'weight' => isset($value['weight']) && !empty($value['weight']) ? $value['weight'] : $weight++,
        );
      }
    }

    // Settings page.
    $items['admin/content/types/nd'] = array(
      'title' => 'Node displays',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'nd_settings',
      ),
      'access arguments' => array(
        'administer content types',
      ),
      'file' => 'includes/nd.admin.inc',
      'type' => MENU_LOCAL_TASK,
      'weight' => 12,
    );
    $items['admin/content/types/nd/settings'] = array(
      'title' => 'Settings',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 0,
    );

    // Build modes.
    $items['admin/content/types/nd/buildmodes'] = array(
      'title' => 'Build modes',
      'page callback' => 'nd_build_modes',
      'access arguments' => array(
        'administer content types',
      ),
      'file' => 'includes/nd.buildmodes.inc',
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
    );

    // Fields.
    $items['admin/content/types/nd/fields'] = array(
      'title' => 'Fields',
      'page callback' => 'nd_fields',
      'access arguments' => array(
        'administer content types',
      ),
      'file' => 'includes/nd.fields.inc',
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
    );
    $items['admin/content/types/nd/plugins'] = array(
      'title' => 'Plugins',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'nd_plugins',
      ),
      'access arguments' => array(
        'administer content types',
      ),
      'file' => 'includes/nd.plugins.inc',
      'type' => MENU_LOCAL_TASK,
      'weight' => 3,
    );
  }
  return $items;
}