You are here

function fieldgroup_menu in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 5 fieldgroup.module \fieldgroup_menu()
  2. 6.3 modules/fieldgroup/fieldgroup.module \fieldgroup_menu()
  3. 6.2 modules/fieldgroup/fieldgroup.module \fieldgroup_menu()

Implementation of hook_menu().

File

modules/fieldgroup/fieldgroup.module, line 17
Create field groups for CCK fields.

Code

function fieldgroup_menu() {
  $items = array();

  // Make sure this doesn't fire until content_types is working,
  // needed to avoid errors on initial installation.
  if (!defined('MAINTENANCE_MODE')) {
    foreach (node_get_types() as $type) {
      $type_name = $type->type;
      $content_type = content_types($type_name);
      $type_url_str = $content_type['url_str'];
      $items['admin/content/node-type/' . $type_url_str . '/add_group'] = array(
        'title' => 'Add group',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'fieldgroup_edit_group_form',
          $content_type,
          '',
          'add',
        ),
        'access arguments' => array(
          'administer content types',
        ),
        'type' => MENU_LOCAL_TASK,
        'weight' => 3,
      );
      $items['admin/content/node-type/' . $type_url_str . '/groups/%/edit'] = array(
        'title' => 'Edit group',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'fieldgroup_edit_group_form',
          $content_type,
          5,
          'edit',
        ),
        'access arguments' => array(
          'administer content types',
        ),
        'type' => MENU_CALLBACK,
      );
      $items['admin/content/node-type/' . $type_url_str . '/groups/%/remove'] = array(
        'title' => 'Edit group',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'fieldgroup_remove_group',
          $content_type,
          5,
        ),
        'access arguments' => array(
          'administer content types',
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}