Hello,
I'm modifying the menu.module so that when the user adds a new menu item or edits an existing menu item, then will be able to upload a menu icon; so that the icon will be displayed along side with the text.
However I'm having difficulty uploading the icon.
I've added form elements to the menu_edit_item_form($mid = 0):
$form['menu_icon_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to menu item icon'),
'#default_value' => t(''),
'#description' => t('some text')
);
$form['menu_icon_upload'] = array(
'#type' => 'file',
'#title' => t('Upload menu item icon'),
'#maxlength' => 40,
'#description' => t("some more text."),
);
In the function menu_edit_item_save($edit) I added the following check:
// Check for a new uploaded menu item icon, and use that instead.
if ($file = file_check_upload($edit['menu_icon_upload'])) {
....
}
However, the above evaluates to false all the time.
When I dump $edit['menu_icon_upload'] all I get is the file name. But not the source directory it is to be picked up from.