You are here

function fieldgroup_menu in Content Construction Kit (CCK) 5

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

@file Create field groups for CCK fields.

File

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

Code

function fieldgroup_menu($may_cache) {
  if (!$may_cache) {
    if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'types' && arg(3)) {
      $content_type = content_types(arg(3));
      if (!empty($content_type) && arg(3) && arg(3) == $content_type['url_str']) {
        $items[] = array(
          'path' => 'admin/content/types/' . arg(3) . '/add_group',
          'title' => t('Add group'),
          'callback' => 'fieldgroup_edit_group',
          'access' => user_access('administer content types'),
          'callback arguments' => array(
            $content_type,
            '',
            'add',
          ),
          'type' => MENU_LOCAL_TASK,
          'weight' => 3,
        );
        if (arg(4) == 'groups' && arg(5)) {
          $items[] = array(
            'path' => 'admin/content/types/' . arg(3) . '/groups/' . arg(5) . '/edit',
            'title' => t('Edit group'),
            'callback' => 'fieldgroup_edit_group',
            'access' => user_access('administer content types'),
            'callback arguments' => array(
              $content_type,
              arg(5),
              'edit',
            ),
            'type' => MENU_CALLBACK_ITEM,
          );
          $items[] = array(
            'path' => 'admin/content/types/' . arg(3) . '/groups/' . arg(5) . '/remove',
            'title' => t('Edit group'),
            'callback' => 'drupal_get_form',
            'callback arguments' => array(
              'fieldgroup_remove_group',
              $content_type,
              arg(5),
            ),
            'access' => user_access('administer content types'),
            'type' => MENU_CALLBACK_ITEM,
          );
        }
      }
    }
    drupal_add_css(drupal_get_path('module', 'fieldgroup') . '/fieldgroup.css');
  }
  return $items;
}