menu_attributes.module | 78 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/menu_attributes.module b/menu_attributes.module index b4b994a..74c49da 100644 --- a/menu_attributes.module +++ b/menu_attributes.module @@ -90,6 +90,70 @@ function menu_attributes_menu_attribute_info() { '#size' => 1, ), ); + $info['onclick'] = array( + 'label' => t('Javascript - onclick'), + 'description' => t('Triggered by a mouse click: mousedown and then mouseup over the element.'), + 'form' => array( + '#type' => 'textarea', + '#rows' => 2, + ), + ); + $info['oncontextmenu'] = array( + 'label' => t('Javascript - oncontextmenu'), + 'description' => t('Triggered by a right-button mouse click over the element.'), + 'form' => array( + '#type' => 'textarea', + '#rows' => 2, + ), + ); + $info['ondblclick'] = array( + 'label' => t('Javascript - ondblclick'), + 'description' => t('Triggered by two clicks within a short time over the element.'), + 'form' => array( + '#type' => 'textarea', + '#rows' => 2, + ), + ); + $info['onmousedown'] = array( + 'label' => t('Javascript - onmousedown'), + 'description' => t('Triggered when a mouse button is pressed down over the element.'), + 'form' => array( + '#type' => 'textarea', + '#rows' => 2, + ), + ); + $info['onmouseup'] = array( + 'label' => t('Javascript - onmouseup'), + 'description' => t('Triggered when a mouse button is released over the element.'), + 'form' => array( + '#type' => 'textarea', + '#rows' => 2, + ), + ); + $info['onmouseover'] = array( + 'label' => t('Javascript - onmouseover'), + 'description' => t('Triggered when the mouse comes over the element.'), + 'form' => array( + '#type' => 'textarea', + '#rows' => 2, + ), + ); + $info['onmouseout'] = array( + 'label' => t('Javascript - onmouseout'), + 'description' => t('Triggered when the mouse goes out of the element.'), + 'form' => array( + '#type' => 'textarea', + '#rows' => 2, + ), + ); + $info['onmousemove'] = array( + 'label' => t('Javascript - onmousemove'), + 'description' => t('Triggered on every mouse move over the element.'), + 'form' => array( + '#type' => 'textarea', + '#rows' => 2, + ), + ); return $info; } @@ -159,18 +223,20 @@ function _menu_attributes_form_alter(array &$form, array $item = array(), array // Restrict access to the new form elements. $form['options']['attributes']['#access'] = user_access('administer menu attributes'); - $form['options']['#tree'] = TRUE; - $form['options']['#weight'] = 50; + $form['options'] = array( + '#type' => 'fieldset', + '#title' => t('Menu item attributes'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#tree' => TRUE, + '#weight' => 50, + ); // Unset the previous value so that the new values get saved. unset($form['options']['#value']['attributes']); $form['options']['attributes'] = array( '#type' => 'fieldset', - '#title' => t('Menu item attributes'), - '#collapsible' => TRUE, - '#collapsed' => FALSE, - '#tree' => TRUE, ); $attributes = menu_attributes_get_menu_attribute_info();