I have almost done small module which should have expand core menu.module with field CSS class. I only need hook on menu.module insert item, update item and delete item functions. How can I hook my insert/update/delete function on this menu.module functions?
I have inspiration from this issue http://drupal.org/node/54946.
There is code (menu_item_class.module):
<?php
// $Id$
/**
* @file
* User defined classes to each menu item
* http://drupal.org/node/54946
*/
/**
* Implementation of hook_help().
*/
function menu_item_class_help($section) {
switch ($section) {
case 'admin/help#menu_item_class':
$output = '
User defined classes to each menu item
';
return $output;
case 'admin/modules#description':
return 'User defined classes to each menu item';
}
}
/**
* Implementation of hook_form_alter().
*/
function menu_item_class_form_alter($form_id, &$form) {
if ('menu_edit_item_form' == $form_id) {
$mid = $form['mid']['#value'];
if (!empty($mid) && $mid != 0) {
$class = db_fetch_array(db_query('SELECT class FROM {menu_item_class} WHERE mid = %d', $mid));
}
else {
$class = '';
}
$form['class'] = array(
'#type' => 'textfield',
'#title' => t('CSS class'),
'#default_value' => $class,
'#description' => t('Individual CSS class for menu item. Applied only if not empty.'),