I have a menu:
Parent-1
- Child-1-1
- Child-1-2
- Child-1-3
- another_child
Parent-2
- Child-2-1
- Child-2-2
- another_child
I needed change the name of Parent-2 item (Parent-2 text is unique), I did it with hook_link_alter()
hook:
/**
* Implements hook_link_alter().
*/
function MY_MODULE_link_alter(&$variables) {
if ($variables['text'] == 'Parent-2') {
$variables['text'] = t('New name');
}
}
I need too to change the names of all child of Parent-2 dynamically. I can't do it with hook_link_alter() hook because in my example there is two elements(another_child) with the same name. Those changes must not be saved in database.
How can I do this?