在配置文件选项卡旁边的选项卡中显示内容类型

Posted

技术标签:

【中文标题】在配置文件选项卡旁边的选项卡中显示内容类型【英文标题】:display a content type in a tab next to the profile tab 【发布时间】:2011-06-12 22:46:54 【问题描述】:

我创建了一个名为“我的笔记”的 drupal 内容类型,我想将其显示在个人资料选项卡旁边的选项卡中。我创建了一个名为“主题”的字段,它显示在“我的笔记”内容类型中。单击“创建我的笔记内容”并填写详细信息后,我希望将其显示在选项卡中。

请给我一步一步的解释。

【问题讨论】:

您是否使用 CCK 或自定义模块创建了“我的笔记”内容类型?您使用的是 Drupal 6 还是 Drupal 7? 你好,Matt,我使用 CCK 在 Drupal 6 中制作了“我的笔记”内容类型。 【参考方案1】:

编写自定义模块并使用 hook_menu_alter() 更改选项卡或添加新选项卡。这是我的自定义模块之一的一些代码

/**
* Implementation of hook_menu_alter(). 
* Remember to clear the menu cache after adding/editing this function.
*/
    function profile_customizations_menu_alter(&$items) 

        // Changing tab names and weights
        $items['user/%user_uid_optional']['weight'] = -10;

        $items['user/%user_category/edit']['title'] = 'Account settings';
        $items['user/%user_category/edit']['weight'] = -9;

        $items['user/%user/profile/individual']['title'] = 'Edit profile';
        $items['user/%user/profile/individual']['weight'] = -8;

        $items['user/%user/profile/ngo']['title'] = 'Edit profile';
        $items['user/%user/profile/ngo']['weight'] = -8;

        $items['user/%user/delete']['title'] = 'Delete account';
        $items['user/%user/delete']['weight'] = 10;

        $items['user/%user/profile']['title'] = 'Profile';
        $items['user/%user/profile']['weight'] = -9;

    /*        $items[] = array( // Change the My account link to display My Profile and drop to bottom of list
                             'path' => 'use/' . $user->uid,
                             'title' => t('My Profile'),
                             'callback' => 'user_view',
                             'callback arguments' => array(arg(1)),
                             'access' => TRUE,
    //                         'type' => MENU_DYNAMIC_ITEM,
                 'type' => MENU_NORMAL_ITEM,
                             'weight' => 9
                        );*/

    //    $items['user/%user/profile/individual']['title'] = 'My Profile';
    /*  $items[] = array(
                'path' => 'user/' . $user->uid . '/profile',
                'title' => t('Profile'),
                'callback' => 'user_view',*/
    

【讨论】:

【参考方案2】:

使用Views 创建配置文件视图,添加页面类型显示,在该页面显示中,您可以为该页面添加菜单选项卡。这是编写任何代码的替代方法,加上视图可以让您更轻松地为页面设置主题。

【讨论】:

【参考方案3】:

使用内容配置文件模块。然后,您将看到将该内容类型添加为配置文件选项卡旁边的选项卡的选项。但我认为它在注册期间也会可见。我不确定。

【讨论】:

以上是关于在配置文件选项卡旁边的选项卡中显示内容类型的主要内容,如果未能解决你的问题,请参考以下文章

QTabWidget 选项卡在其中一个选项卡中不显示任何内容

在标签布局中看不到我的cardView

选项卡内容布局显示在其他选项卡中

在 facebook 页面的选项卡中查看 facebook 应用程序时不显示任何内容

如何刷新 Python TKINTER 选项卡中的内容?

在运行时使用 QTabWidget 将内容加载到选项卡中