Hi,

I want to change the Text of some Tabs, on a specific page. In this case the profile pages.

For example the "Edit" and "View" Link should changed to "Show Profile" and "Profile Configuration".

Is this possible and how complicated is it, to achieve this goal?

thanks for any help,
Marc

Comments

dnewkerk’s picture

Here's a code snippet I wrote in template.php for one of my sites... should get you on the right track. Note change YOURTHEME to your theme's name, and if you already have a preprocess_page function, you need to integrate this into it (otherwise just paste as is):

function YOURTHEME_preprocess_page(&$vars) {
  /**
   * Tweak wording on Edit tabs.
   */
  // Append the Content type's name to the Edit tabs for nodes.
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = $vars['node'];
    $content_type_name = node_get_types('name', $node);
    $vars['tabs'] = str_replace('Edit', 'Edit ' . $content_type_name, $vars['tabs']);
  }
  
  // Append the word "profile" to the Edit tab on user profile page.
  if (arg(0) == 'user' && is_numeric(arg(1))) {
    $vars['tabs'] = str_replace('Edit', 'Edit ' . 'profile', $vars['tabs']);
  }
} // End phptemplate_preprocess_page function.

Code here might be helpful too http://drupal.org/node/483324 for an alternative method of getting at the tabs.

Many tabs you can also reword more easily using http://drupal.org/project/stringoverrides however this probably won't help on tabs like View or Edit which are used in multiple contexts.

karc2008’s picture

I guess to extend it, i just add more $vars-lines to it, right?

thanks again. I´m happy, that this is working - it´s just a lot more logical now for users.