I am currently building a site using 1.6 and needed to add accesskey fucntionality for accessibillity reasons.
After much reseach, i didn't find any suitable methods of doing this so i went a created a hack to achieve my goal. The building blocks were taken from a tut i found on a sub site of Joomlashack but i found it didn't work so i put my own spin on it.
Works for me so i thought i would share it with you all. Hopefully accesskeys will be included in future releases of Joomla.
----------------------------------------------------------------------------------------------
We first need to add the access key field to the menu item attribute. To do this we need to edit:
administrator/components/com_menus/models/forms/item_component.xml
Around line 31 (before the closing fieldset) add the following code:
Code: Select all
<!-- Accesskey Hack Joomla 1.6 -->
<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 = "" />
</fieldset>
administrator/language/en-GB/en-GB.com_menus.ini
Once you have uploaded the files, you should now be able to access the accesskey attribute in the edit main item page under "Link Type Options" (Right hand side panel)
We now have to edit some of the core files so the access key displays in the outputted HTML.
Open modules/mod_menu/helper.php (make sure to open the modules folder from the root and not the admin folder.)
Around line 113 add the following line of code:
Code: Select all
$item->accesskey = htmlspecialchars ($item-> params->get('menu_accesskey',''));
Now open the following file: modules/mod_menu/tmpl/default_component.php$item->title = htmlspecialchars($item->title);
$item->accesskey = htmlspecialchars ($item-> params->get('menu_accesskey',''));
$item->anchor_css = htmlspecialchars($item->params->get('menu-anchor_css', ''));
$item->anchor_title = htmlspecialchars($item->params->get('menu-anchor_title', ''));
$item->menu_image = $item->params->get('menu_image', '') ? htmlspecialchars($item->params->get('menu_image', '')) : '';
On line 27 we need to change the Case 0 from:
Code: Select all
?><a <?php echo $class; ?>href="<?php echo $item->flink; ?>" <?php echo $title; ?>><?php echo $linktype; ?></a><?php
break;
Code: Select all
?><a accesskey="<?php echo $item->accesskey; ?>"<?php echo $class;?>href ="<?php echo $item->flink; ?>" <?php echo $title;
?>><?php echo $linktype;?></a><?php
break;
Hope it helps other out there. Enjoy.