Add tags accesskey in Joomla! 1.6
We has know how to add keyboard shortcuts (accesskey) and the title tag to the main menu links in Joomla! 1.5 . In this new article we will look the same but for the new version of Joomla, 1.6. In this way approach the content manager to a better level of accessibility.
1 / Add new field in the administrator
To add the new field we need to edit the file administrator / components / com_menus / models / forms / item_component.xml. We will go to line 31 of file and add the following:
<! - By sergiois - www.sergioiglesias.net ->
<Field name = "menu_accesskey" type = "text"
label = "COM_MENUS_ITEM_FIELD_MENU_ACCESSKEY_LABEL"
description = "COM_MENUS_ITEM_FIELD_MENU_ACCESSKEY_DESC"
size = "1" default = "" />
After this, we need to add labels in the label and description language files. Thus, we do multilingual. Labels to be added are:
* To es-ES: COM_MENUS_ITEM_FIELD_MENU_ACCESSKEY_LABEL = "Accesskey" and COM_MENUS_ITEM_FIELD_MENU_ACCESSKEY_DESC = "Enter the hotkey to the menu."
* To en-GB: COM_MENUS_ITEM_FIELD_MENU_ACCESSKEY_LABEL = "Accesskey" COM_MENUS_ITEM_FIELD_MENU_ACCESSKEY_DESC = "Enter the accesskey menu."
When accessing the Administrator, see how successfully added this field in the tab "link type options."
Accesskey Joomla! 1.6 - Administrator
NOTE: include the link attribute <title> is the first field that appears on this tab (Attribute to the link title.)
2 / Remove the accesskey attribute on the site
To set the accesskey attribute in the main menu item, we have to edit two files in the module menu.
In line 113 of modules / mod_menu / helper.php have to add the following line of code:
$ Item-> accesskey = htmlspecialchars ($ item-> params-> get ('menu_accesskey',''));
In line 29 of modules / mod_menu / tmpl / default_component.php we must modify the following line of code in the case 0:
?> <a Accesskey="accesskey; ?> "<? Php echo $ class;?> Href =" / flink;?> "<? Php echo $ title; ?>><? php echo $ linktype;?> < / a> <? php
With this you can use shortcut keys in the main menu links. Something that is very important for accessibility in web sites.
See if in subsequent versions of Joomla! 1.6, we can include it in the CORE.