/[drupal]/contributions/modules/accesskeys/accesskeys.module
ViewVC logotype

Contents of /contributions/modules/accesskeys/accesskeys.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1.1.1 - (show annotations) (download) (as text) (vendor branch)
Mon Jan 26 10:23:03 2009 UTC (10 months ago) by bjoern
Branch: MAIN, DRUPAL-6--1
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/x-php


1 <?php
2 // $Id: accesskeys.info,v 1.0 2009/01/25 16:68:00:00 Bjoern Exp $
3
4 function accesskeys_perm() {
5 return array('administer access keys');
6 }
7
8
9 function accesskeys_form_alter(&$form, $form_state, $form_id) {
10 if ('menu_edit_item' == $form_id) {
11
12 }
13
14 if ((isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id) || ('menu_edit_item' == $form_id)) {
15 if ($form['#node']->type .'_node_form' == $form_id) {
16 $item = $form['#node']->menu;
17 } else {
18 $item = $form['menu']['#item'];
19 }
20
21 if (!isset($form['menu'])) {
22 $form['menu'] = array(
23 '#type' => 'fieldset',
24 '#title' => t('Menu settings'),
25 '#access' => user_access('administer menu'),
26 '#collapsible' => TRUE,
27 '#collapsed' => FALSE,
28 '#tree' => TRUE,
29 '#weight' => -2,
30 '#attributes' => array('class' => 'menu-item-form'),
31 );
32 }
33 $form['menu']['options'] = array(
34 '#type' => 'fieldset',
35 '#title' => t('Access Key'),
36 '#access' => user_access('administer access key'),
37 '#collapsible' => TRUE,
38 '#collapsed' => FALSE,
39 '#tree' => TRUE,
40 '#weight' => 50,
41 );
42 $form['menu']['options']['attributes']['accesskey'] = array(
43 '#type' => 'textfield',
44 '#title' => t('Access Key'),
45 '#default_value' => $item['options']['attributes']['accesskey'],
46 '#required' => FALSE,
47 );
48 }
49 }
50
51 function accesskeys_menu_link_alter(&$item, $menu) {
52 if (is_array($item['options']['attributes'])) {
53 foreach ($item['options']['attributes'] as $key=>$value) {
54 if (empty($value)) {
55 unset($item['options']['attributes'][$key]);
56 }
57 }
58 }
59 }
60
61

  ViewVC Help
Powered by ViewVC 1.1.2