21490 Posts in 5783 Topics by 2622 members
| Go to End | Next > | |
| Author | Topic: | 1013 Views |
-
Re: Access Keys

27 February 2009 at 3:00pm
We have done this on 1 project, all we did was make another 1 line txt field in the CMS for the access key then in the <% control Menu %> or <% control Children %> calls we just did <a href="$Link" <% if AccessKey %>accesskey="$AccessKey"<% end_if %>> and then you can set the accesskey in the cms
-
Re: Access Keys

27 February 2009 at 10:29pm Last edited: 27 February 2009 10:30pm
I think it would be a good idea to add in another tab called "Accessibility" and add the new "Access Key" field to that. Can this be done?
-
Re: Access Keys

28 February 2009 at 2:12pm
Sure, In your mysite/code/Page.php file you need to add a database field for it so add an entry to the static $db array
static $db = array(
.. whatever else
'AccessKey' => 'Varchar(1)'
);Then add a tab and field to the cms but adding a line to the getCMSFields() function in that same file
function getCMSFields() {
$fields = parent::getCMSFields();
.. whatever else
$fields->addFieldToTab('Root.Content.Accessibility', new TextField('AccessKey'));return $fields;
}Then in your templates just use $AccessKey where ever you output pages.
-
Re: Access Keys

19 April 2011 at 7:05pm
Minor addition to this example, namely set the length of the text field to 1
$tf = new TextField('AccessKey');
$tf->setMaxLength(1);
$fields->addFieldToTab('Root.Content.Accessibility', $tf);Cheers,
Gordon
-
Re: Access Keys

16 November 2012 at 11:50pm
hi
I've created a module (for Silverstripe 2.4 currently, will upgrade to 3 at some point) to encompass access key functionality:
- Adds an access key tab to every page in the CMS editor, where an access key can be optionally set
- Adds an Include template to render the access keys in your HTML
- Adds an accessibility information page that displays the access keys in readable form for reference
- Adds an accessibility tab to the Site Configuration in the CMS with option of configuring the 'Skip to Navigation' access keyMore information can be found at http://weboftalent.asia/blog/access-keys-module/
Cheers
Gordon
| 1013 Views | ||
| Go to Top | Next > |


