<tfoot id='WQVDG'></tfoot>
        <bdo id='WQVDG'></bdo><ul id='WQVDG'></ul>

      <small id='WQVDG'></small><noframes id='WQVDG'>

      <legend id='WQVDG'><style id='WQVDG'><dir id='WQVDG'><q id='WQVDG'></q></dir></style></legend>

        <i id='WQVDG'><tr id='WQVDG'><dt id='WQVDG'><q id='WQVDG'><span id='WQVDG'><b id='WQVDG'><form id='WQVDG'><ins id='WQVDG'></ins><ul id='WQVDG'></ul><sub id='WQVDG'></sub></form><legend id='WQVDG'></legend><bdo id='WQVDG'><pre id='WQVDG'><center id='WQVDG'></center></pre></bdo></b><th id='WQVDG'></th></span></q></dt></tr></i><div id='WQVDG'><tfoot id='WQVDG'></tfoot><dl id='WQVDG'><fieldset id='WQVDG'></fieldset></dl></div>

        Drupal - 将“user/%/edit/uprofile"设置为“user/%/edit"上的

        Drupal - Set #39;user/%/edit/uprofile#39; to default tab on #39;user/%/edit#39;(Drupal - 将“user/%/edit/uprofile设置为“user/%/edit上的默认选项卡)
          <tbody id='XzYkM'></tbody>

            <bdo id='XzYkM'></bdo><ul id='XzYkM'></ul>

            • <i id='XzYkM'><tr id='XzYkM'><dt id='XzYkM'><q id='XzYkM'><span id='XzYkM'><b id='XzYkM'><form id='XzYkM'><ins id='XzYkM'></ins><ul id='XzYkM'></ul><sub id='XzYkM'></sub></form><legend id='XzYkM'></legend><bdo id='XzYkM'><pre id='XzYkM'><center id='XzYkM'></center></pre></bdo></b><th id='XzYkM'></th></span></q></dt></tr></i><div id='XzYkM'><tfoot id='XzYkM'></tfoot><dl id='XzYkM'><fieldset id='XzYkM'></fieldset></dl></div>

                1. <small id='XzYkM'></small><noframes id='XzYkM'>

                  <tfoot id='XzYkM'></tfoot>

                  <legend id='XzYkM'><style id='XzYkM'><dir id='XzYkM'><q id='XzYkM'></q></dir></style></legend>
                  本文介绍了Drupal - 将“user/%/edit/uprofile"设置为“user/%/edit"上的默认选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用内容配置文件模块.当用户在查看个人资料页面并按编辑时,他们希望显示个人资料编辑页面,而不是现在的帐户设置.内容配置文件编辑页面的路径是user/%/edit/uprofile".有谁知道如何将user/%/edit/uprofile"设置为user/%/edit"的默认选项卡?

                  I'm using the content profile module. When a user is on their view profile page and press edit, they expect the profile edit page to show, not account settings as it is now. The path to content profile edit page is 'user/%/edit/uprofile'. Does anyone know how to set the 'user/%/edit/uprofile' to default tab for 'user/%/edit'?

                  推荐答案

                  Edit 2 (for Content Profile)

                  此示例适用于内容配置文件"选项卡.只需将 $type 更改为配置文件的内容类型的简称.这也展示了如何清理代码以供实际使用(我之前的示例非常非常冗长):

                  Edit 2 (for Content Profile)

                  This example is for a Content Profile tab. Just change $type to the short name of the content type for the profile. This also shows how to clean up the code for real-world use (my previous examples were really, really verbose):

                  function mymodule_menu_alter(&$items) {
                    // Specify the content profile type you'd like to work with
                    $type = 'profile';
                  
                    // Make sure the user has a Content Profile to edit
                    if (!empty($items['user/%user_category/edit/' . $type])) {
                      // Pull out the menu items we want to modify.
                      $account  = &$items['user/%user_category/edit/account'];
                      $edit     = &$items['user/%user_category/edit'];
                      $profile  = &$items['user/%user_category/edit/' . $type];
                  
                      // Specify the Edit Account page as just a regular tab. 
                      // You do not need to change this block: this will always be the same as long 
                      // as you don't want Edit account to be the default tab.
                      $account = array(
                        'type' => MENU_LOCAL_TASK,
                        'page callback' => $edit['page callback'],
                        'page arguments' => $edit['page arguments'],
                        'access callback' => $edit['access callback'],
                        'access arguments' => $edit['access arguments'],
                        'module' => $edit['module'],
                        'file' => $edit['file'],
                      ) + $account;
                  
                      // Change the default action to take when hitting user/<UID>/edit to
                      // the content profile
                      $edit = array(
                        'page callback' => $profile['page callback'],
                        'page arguments' => $profile['page arguments'],
                        'access callback' => $profile['access callback'],
                        'access arguments' => $profile['access arguments'],
                        'file' => $profile['file'],
                        'file path' => $profile['file path'],
                      ) + $edit;
                  
                      // Specify the profile page as the default tab and remove settings
                      // already set above
                      $profile['type'] = MENU_DEFAULT_LOCAL_TASK;
                      unset($profile['page callback'], 
                        $profile['page arguments'], 
                        $profile['access callback'], 
                        $profile['access arguments'], 
                        $profile['file'], 
                        $profile['file path']);
                    }
                  }
                  

                  <小时>

                  编辑 1(用于 Core 的配置文件模块)

                  我没有意识到您想要更改编辑下的默认选项卡.它与我在下面描述的一般原则相同,但有一些小的修改.此示例将使 Personal 选项卡(位于 user//edit/Personal)成为默认选项,而不是帐户选项卡:


                  Edit 1 (for Core's Profile module)

                  I didn't realize you wanted to change the default tabs under Edit. It's the same general principle as I described below, but with some minor modifications. This example will make the Personal tab (at user/<UID>/edit/Personal) default instead of the account tab:

                  function mymodule_menu_alter(&$items) {
                    // Specify the Edit Account page as just a regular tab. 
                    // You do not need to change this block: this will always be the same as long 
                    // as you don't want Edit account to be the default tab.
                    $items['user/%user_category/edit/account']['type'] = MENU_LOCAL_TASK;
                    $items['user/%user_category/edit/account']['page callback'] = $items['user/%user_category/edit']['page callback'];
                    $items['user/%user_category/edit/account']['page arguments'] = $items['user/%user_category/edit']['page arguments'];
                    $items['user/%user_category/edit/account']['access callback'] = $items['user/%user_category/edit']['access callback'];
                    $items['user/%user_category/edit/account']['access arguments'] = $items['user/%user_category/edit']['access arguments'];
                    $items['user/%user_category/edit/account']['module'] = $items['user/%user_category/edit']['module'];
                    $items['user/%user_category/edit/account']['file'] = $items['user/%user_category/edit']['file'];
                  
                    // Change default action to take when hitting user/<UID>/edit to
                    // the settings of the page you want to use.
                    // -- Custom settings start here --
                    $items['user/%user_category/edit']['page callback'] = $items['user/%user_category/edit/Personal']['page callback'];
                    $items['user/%user_category/edit']['page arguments'] = $items['user/%user_category/edit/Personal']['page arguments'];
                    $items['user/%user_category/edit']['access callback'] = $items['user/%user_category/edit/Personal']['access callback'];
                    $items['user/%user_category/edit']['access arguments'] = $items['user/%user_category/edit/Personal']['access arguments'];
                    $items['user/%user_category/edit']['module'] = $items['user/%user_category/edit/Personal']['module'];
                    $items['user/%user_category/edit']['file'] = $items['user/%user_category/edit/Personal']['file'];
                  
                    // When loading a profile tab, user_edit needs two parameters. The second parameter is the name of the profile
                    // (i.e. Personal from user/<UID>/edit/Personal).
                    $items['user/%user_category/edit']['page arguments'] = array(1, 'Personal');
                  
                    // Specify the Personal page as the default tab and remove settings
                    // already set above */
                    $items['user/%user_category/edit/Personal']['type'] = MENU_DEFAULT_LOCAL_TASK;
                    unset($items['user/%user_category/edit/Personal']['page callback']);
                    unset($items['user/%user_category/edit/Personal']['page arguments']);
                    unset($items['user/%user_category/edit/Personal']['access callback']);
                    unset($items['user/%user_category/edit/Personal']['access arguments']);
                    unset($items['user/%user_category/edit/Personal']['module']);
                    unset($items['user/%user_category/edit/Personal']['file']);
                  }
                  

                  <小时>

                  概述和概念

                  您可以使用 hook_menu_alter并更改特定标签的类型.


                  Overview and Concept

                  You can do this with hook_menu_alter and changing the types for specific tabs.

                  更改默认选项卡是一个痛苦的过程.基本上,默认选项卡继承了页面的所有属性,而没有选择任何选项卡.这允许用户转到 user/UID 并获取查看页面,而无需直接转到 user/UID/view.

                  Changing the default tab is a little bit of a harrowing process. Basically, the default tab inherits all the properties of the page without any tabs selected. This allows a user to go to user/UID and get the view page without having to go directly to user/UID/view.

                  要更清楚地了解这一点,请查看user_menu() 钩子实现.请注意 $items['user/%user/view'] 是如何相当空的,而 $items['user/%user_uid_optional'] 包含您想要的所有设置'我希望在 $items['user/%user/view'] 下看到.

                  To get a clearer understanding of this, check out the user_menu() hook implementation. Note how $items['user/%user/view'] is pretty empty, and $items['user/%user_uid_optional'] contains all the settings you would've expected to see under $items['user/%user/view'].

                  因此,您首先要设置视图选项卡以充当常规选项卡:为此,您必须复制附加到 user/UID<的所有设置/code> 菜单项并将它们放入 user/UID/view 菜单项中.

                  So, you're going to first set up the view tab to act as a regular tab: to do this, you're going to have to copy all the settings that are attached to the user/UID menu item and put them into the user/UID/view menu item.

                  完成此操作后,您将使用要成为默认选项卡的选项卡的设置替换 user/UID 的设置.

                  Once you do that, you're going to replace the settings for user/UID with the settings for the tab you want to become the default tab.

                  最后,您将取消默认选项卡的所有菜单项设置,因为它将继承 user/UID 的设置.

                  Finally, you're going to unset all the menu items for the default tab since it will inherit the settings for user/UID.

                  查看这段代码,它使 Edit 选项卡默认:

                  Check out this code which makes the Edit tab default:

                  function mymodule_menu_alter(&$items) {
                    // Specify the View page as just a regular tab. 
                    // You do not need to change this block: this will always be the same as long 
                    // as you don't want View to be the default tab.
                    $items['user/%user/view']['type'] = MENU_LOCAL_TASK;
                    $items['user/%user/view']['page callback'] = $items['user/%user_uid_optional']['page callback'];
                    $items['user/%user/view']['page arguments'] = $items['user/%user_uid_optional']['page arguments'];
                    $items['user/%user/view']['access callback'] = $items['user/%user_uid_optional']['access callback'];
                    $items['user/%user/view']['access arguments'] = $items['user/%user_uid_optional']['access arguments'];
                    $items['user/%user/view']['file'] = $items['user/%user_uid_optional']['file'];
                  
                    // Normal tabs don't have a weight
                    unset($items['user/%user/view']['weight']);
                  
                    // Change default action to take when hitting user/<UID> to
                    // the settings of the page you want to use.
                    // -- Custom settings start here --
                    $items['user/%user_uid_optional']['page callback'] = $items['user/%user_category/edit']['page callback'];
                    $items['user/%user_uid_optional']['page arguments'] = $items['user/%user_category/edit']['page arguments'];
                    $items['user/%user_uid_optional']['access callback'] = $items['user/%user_category/edit']['access callback'];
                    $items['user/%user_uid_optional']['access arguments'] = $items['user/%user_category/edit']['access arguments'];
                    $items['user/%user_uid_optional']['file'] = $items['user/%user_category/edit']['file'];
                  
                    // Specify the Edit page as the default tab and remove settings
                    // already set above
                    $items['user/%user_category/edit']['type'] = MENU_DEFAULT_LOCAL_TASK;
                    $items['user/%user_category/edit']['weight'] = -10;
                    unset($items['user/%user_category/edit']['page callback']);
                    unset($items['user/%user_category/edit']['page arguments']);
                    unset($items['user/%user_category/edit']['access callback']);
                    unset($items['user/%user_category/edit']['access arguments']);
                    unset($items['user/%user_category/edit']['file']);
                  }
                  

                  将功能的第二部分替换为菜单项的设置,您应该处于良好状态.当然,请记住在进行任何菜单更改后清除缓存以使它们生效.

                  Replace the second part of the function with the settings for your menu item and you should be in good shape. Of course, remember to clear the cache after making any menu changes for them to take effect.

                  这篇关于Drupal - 将“user/%/edit/uprofile"设置为“user/%/edit"上的默认选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tfoot id='PECLE'></tfoot>
                        <tbody id='PECLE'></tbody>

                        • <bdo id='PECLE'></bdo><ul id='PECLE'></ul>
                          <legend id='PECLE'><style id='PECLE'><dir id='PECLE'><q id='PECLE'></q></dir></style></legend>
                          <i id='PECLE'><tr id='PECLE'><dt id='PECLE'><q id='PECLE'><span id='PECLE'><b id='PECLE'><form id='PECLE'><ins id='PECLE'></ins><ul id='PECLE'></ul><sub id='PECLE'></sub></form><legend id='PECLE'></legend><bdo id='PECLE'><pre id='PECLE'><center id='PECLE'></center></pre></bdo></b><th id='PECLE'></th></span></q></dt></tr></i><div id='PECLE'><tfoot id='PECLE'></tfoot><dl id='PECLE'><fieldset id='PECLE'></fieldset></dl></div>

                          <small id='PECLE'></small><noframes id='PECLE'>