1

I'm trying to override the title of a system provided local task. I have the following code which works for uid 1 but not authenticated users:

function test_controller_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  if ($root_path == 'user/%') {
    foreach($data['tabs'][0]['output'] as $key => $item) {
      if ($item['#link']['path'] == 'user/%/edit') {
        $data['tabs'][0]['output'][$key]['#link']['title'] = t('Password and email address');
      }
    }
  }
}

According to this issue this is expected behaviour for the time being. Is there another way round this?

2 Answers 2

1

i have an idea if you use string override module .this module provide the override the local task menu.

http://drupal.org/project/stringoverrides/

1

I'm not sure for you digital, but the authenticated must have first the rights to modify their own account to see the local task. And the code below worked for me :

$pattern = '/^user/';
if (preg_match($pattern, $root_path)) {
  foreach($data['tabs'][0]['output'] as $key => $item){
    if(isset($item['#link']['path']) && $item['#link']['path'] == 'user/%/view'){
      $data['tabs'][0]['output'][$key]['#link']['title'] = t('My personal tools');
    }
  }
}

I used a pattern so the title stays the same on each user's page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.