Halaman

Senin, 05 Maret 2012

Remove Title Atributes of Menu Links from Taxonomy Generated Menu

Drupal 7: To generate menus using Taxonomy menu, we do the following steps:

1. http://mysitedom.com/admin/structure/taxonomy/my-vocabulary/list
2. Click the Edit tab
3. Select MENU location from list.
3. Check the option to "Select to rebuild the menu on submit".
4. Click the Save button, so a menu structure will be generated for the selected Vocabulary.

But I have a problem with the title attribute of URLs that are automatically filled in by the descriptions of vocabulary terms. I thought this is quite annoying, especially against the long description.

Do not hack core. This phrase is commonly heard in the Drupal community.

For my requirement, I've did this:
Modify taxonomy_menu.module file under \myhome\sites\all\modules\taxonomy_menu\ directories, to make changes of the function_taxonomy_menu_save. At line number 568-569 which contains the command:
'options' => array('attributes' => array('title' => trim($item['description'])
? $item['description'] : $item['name'])),

commenting out the line:
/* 'options' => array('attributes' => array('title' => trim($item['description'])
? $item['description'] : $item['name'])), */


After hitting my menu at http://mysitedom.com/admin/structure/menu/manage/my-taxo-menu, click Edit of each generated menu link to clear 'Description' field, I repeat the four steps above to rebuild menu, now Title attribute dissapear from menu link.



Tidak ada komentar:

Posting Komentar